mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-11 07:46:05 -07:00
34 lines
771 B
C#
34 lines
771 B
C#
using System;
|
|
using Polly.Retry;
|
|
using Polly;
|
|
|
|
namespace PlexRequests.Api
|
|
{
|
|
public static class RetryHandler
|
|
{
|
|
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] TimeSpan, Action action)
|
|
{
|
|
var policy = Policy.Handle<Exception> ()
|
|
.WaitAndRetry(TimeSpan, (exception, timeSpan) => action());
|
|
|
|
return policy;
|
|
}
|
|
|
|
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] TimeSpan)
|
|
{
|
|
var policy = Policy.Handle<Exception> ()
|
|
.WaitAndRetry(TimeSpan);
|
|
|
|
return policy;
|
|
}
|
|
|
|
public static RetryPolicy RetryAndWaitPolicy(TimeSpan[] TimeSpan, Action<Exception, TimeSpan> action)
|
|
{
|
|
var policy = Policy.Handle<Exception> ()
|
|
.WaitAndRetry(TimeSpan, (exception, timeSpan) => action(exception, timeSpan));
|
|
|
|
return policy;
|
|
}
|
|
}
|
|
}
|
|
|