mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-07-12 16:22:55 -07:00
Reduce the retry time
This commit is contained in:
parent
3384ba90fc
commit
795e691bdb
6 changed files with 18 additions and 14 deletions
|
@ -65,9 +65,7 @@ namespace PlexRequests.Api
|
||||||
|
|
||||||
var obj = RetryHandler.Execute(() => Api.ExecuteJson<JObject>(request, baseUrl),
|
var obj = RetryHandler.Execute(() => Api.ExecuteJson<JObject>(request, baseUrl),
|
||||||
(exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan), new[] {
|
(exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan), new[] {
|
||||||
TimeSpan.FromSeconds (2),
|
TimeSpan.FromSeconds (2)});
|
||||||
TimeSpan.FromSeconds(5),
|
|
||||||
TimeSpan.FromSeconds(10)});
|
|
||||||
|
|
||||||
|
|
||||||
if (obj.Count > 0)
|
if (obj.Count > 0)
|
||||||
|
|
|
@ -33,7 +33,7 @@ namespace PlexRequests.Api
|
||||||
{
|
{
|
||||||
public static class RetryHandler
|
public static class RetryHandler
|
||||||
{
|
{
|
||||||
private static readonly TimeSpan[] DefaultRetryTime = { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(10) };
|
private static readonly TimeSpan[] DefaultRetryTime = { TimeSpan.FromSeconds(2), TimeSpan.FromSeconds(5), TimeSpan.FromSeconds(5) };
|
||||||
|
|
||||||
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan = null)
|
public static T Execute<T>(Func<T> action, TimeSpan[] timeSpan = null)
|
||||||
{
|
{
|
||||||
|
|
|
@ -117,8 +117,7 @@ namespace PlexRequests.Api
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
||||||
TimeSpan.FromSeconds (1),
|
TimeSpan.FromSeconds (2)
|
||||||
TimeSpan.FromSeconds(2),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
result = policy.Execute(() => Api.ExecuteJson<SonarrAddSeries>(request, baseUrl));
|
result = policy.Execute(() => Api.ExecuteJson<SonarrAddSeries>(request, baseUrl));
|
||||||
|
@ -186,8 +185,7 @@ namespace PlexRequests.Api
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling AddSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
||||||
TimeSpan.FromSeconds (1),
|
TimeSpan.FromSeconds (2)
|
||||||
TimeSpan.FromSeconds(2),
|
|
||||||
});
|
});
|
||||||
|
|
||||||
result = policy.Execute(() => Api.ExecuteJson<SonarrAddSeries>(request, baseUrl));
|
result = policy.Execute(() => Api.ExecuteJson<SonarrAddSeries>(request, baseUrl));
|
||||||
|
@ -228,8 +226,8 @@ namespace PlexRequests.Api
|
||||||
{
|
{
|
||||||
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling GetSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
var policy = RetryHandler.RetryAndWaitPolicy((exception, timespan) => Log.Error(exception, "Exception when calling GetSeries for Sonarr, Retrying {0}", timespan), new TimeSpan[] {
|
||||||
TimeSpan.FromSeconds (5),
|
TimeSpan.FromSeconds (5),
|
||||||
TimeSpan.FromSeconds(10),
|
TimeSpan.FromSeconds(5),
|
||||||
TimeSpan.FromSeconds(30)
|
TimeSpan.FromSeconds(5)
|
||||||
});
|
});
|
||||||
|
|
||||||
return policy.Execute(() => Api.ExecuteJson<List<Series>>(request, baseUrl));
|
return policy.Execute(() => Api.ExecuteJson<List<Series>>(request, baseUrl));
|
||||||
|
|
|
@ -151,7 +151,7 @@ namespace PlexRequests.Core.StatusChecker
|
||||||
var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}";
|
var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}";
|
||||||
|
|
||||||
var branchDisplay = EnumHelper<Branches>.GetDisplayValue(branch);
|
var branchDisplay = EnumHelper<Branches>.GetDisplayValue(branch);
|
||||||
var localVersion = AssemblyHelper.GetProductVersion();
|
var localVersion = AssemblyHelper.GetFileVersion();
|
||||||
var localVersionExtended = $"{localVersion.Remove(localVersion.Length - 2, 2)}00";
|
var localVersionExtended = $"{localVersion.Remove(localVersion.Length - 2, 2)}00";
|
||||||
|
|
||||||
var model = new StatusModel
|
var model = new StatusModel
|
||||||
|
|
|
@ -45,5 +45,13 @@ namespace PlexRequests.Helpers
|
||||||
var retVersion = fvi.ProductVersion;
|
var retVersion = fvi.ProductVersion;
|
||||||
return retVersion;
|
return retVersion;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public static string GetFileVersion()
|
||||||
|
{
|
||||||
|
var assembly = Assembly.GetExecutingAssembly();
|
||||||
|
var fvi = FileVersionInfo.GetVersionInfo(assembly.Location);
|
||||||
|
var retVersion = fvi.FileVersion;
|
||||||
|
return retVersion;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -68,9 +68,9 @@ namespace PlexRequests.UI.Modules
|
||||||
{
|
{
|
||||||
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false });
|
return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false });
|
||||||
}
|
}
|
||||||
#if DEBUG
|
//#if DEBUG
|
||||||
return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false});
|
//return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false});
|
||||||
#endif
|
//#endif
|
||||||
var checker = new StatusChecker(SystemSettings);
|
var checker = new StatusChecker(SystemSettings);
|
||||||
var release = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async() => await checker.GetStatus(), 30);
|
var release = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async() => await checker.GetStatus(), 30);
|
||||||
|
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue