mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-16 02:02:55 -07:00
Async async async improvements.
This commit is contained in:
parent
236024e4ae
commit
b3e90c7a7f
19 changed files with 785 additions and 755 deletions
|
@ -33,13 +33,13 @@ namespace PlexRequests.Api
|
|||
{
|
||||
public static class RetryHandler
|
||||
{
|
||||
private static readonly TimeSpan[] DefaultTime = { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10) };
|
||||
private static readonly TimeSpan[] DefaultRetryTime = { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10) };
|
||||
|
||||
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan = null)
|
||||
{
|
||||
if (timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
timeSpan = DefaultRetryTime;
|
||||
}
|
||||
var policy = RetryAndWaitPolicy(timeSpan);
|
||||
|
||||
|
@ -50,7 +50,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
if (timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
timeSpan = DefaultRetryTime;
|
||||
}
|
||||
var policy = RetryAndWaitPolicy(action, timeSpan);
|
||||
|
||||
|
@ -61,7 +61,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
if (timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
timeSpan = DefaultRetryTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception>().WaitAndRetry(timeSpan, (e, ts) => action());
|
||||
|
||||
|
@ -72,7 +72,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
if (timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
timeSpan = DefaultRetryTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception>().WaitAndRetry(timeSpan);
|
||||
|
||||
|
@ -83,7 +83,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
if (timeSpan == null)
|
||||
{
|
||||
timeSpan = DefaultTime;
|
||||
timeSpan = DefaultRetryTime;
|
||||
}
|
||||
var policy = Policy.Handle<Exception>().WaitAndRetry(timeSpan, action);
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue