From 795e691bdb80a7014642aee26c808af43ff7b1c8 Mon Sep 17 00:00:00 2001 From: "Jamie.Rees" Date: Wed, 16 Nov 2016 17:31:20 +0000 Subject: [PATCH] Reduce the retry time --- PlexRequests.Api/CouchPotatoApi.cs | 4 +--- PlexRequests.Api/RetryHandler.cs | 2 +- PlexRequests.Api/SonarrApi.cs | 10 ++++------ PlexRequests.Core/StatusChecker/StatusChecker.cs | 2 +- PlexRequests.Helpers/AssemblyHelper.cs | 8 ++++++++ PlexRequests.UI/Modules/LayoutModule.cs | 6 +++--- 6 files changed, 18 insertions(+), 14 deletions(-) diff --git a/PlexRequests.Api/CouchPotatoApi.cs b/PlexRequests.Api/CouchPotatoApi.cs index e4382ff22..9523d7284 100644 --- a/PlexRequests.Api/CouchPotatoApi.cs +++ b/PlexRequests.Api/CouchPotatoApi.cs @@ -65,9 +65,7 @@ namespace PlexRequests.Api var obj = RetryHandler.Execute(() => Api.ExecuteJson(request, baseUrl), (exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan), new[] { - TimeSpan.FromSeconds (2), - TimeSpan.FromSeconds(5), - TimeSpan.FromSeconds(10)}); + TimeSpan.FromSeconds (2)}); if (obj.Count > 0) diff --git a/PlexRequests.Api/RetryHandler.cs b/PlexRequests.Api/RetryHandler.cs index d3ffb1912..f385b6c5c 100644 --- a/PlexRequests.Api/RetryHandler.cs +++ b/PlexRequests.Api/RetryHandler.cs @@ -33,7 +33,7 @@ namespace PlexRequests.Api { 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(Func action, TimeSpan[] timeSpan = null) { diff --git a/PlexRequests.Api/SonarrApi.cs b/PlexRequests.Api/SonarrApi.cs index 961f04ea2..10811f10f 100644 --- a/PlexRequests.Api/SonarrApi.cs +++ b/PlexRequests.Api/SonarrApi.cs @@ -117,8 +117,7 @@ namespace PlexRequests.Api try { 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(request, baseUrl)); @@ -186,8 +185,7 @@ namespace PlexRequests.Api try { 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(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[] { TimeSpan.FromSeconds (5), - TimeSpan.FromSeconds(10), - TimeSpan.FromSeconds(30) + TimeSpan.FromSeconds(5), + TimeSpan.FromSeconds(5) }); return policy.Execute(() => Api.ExecuteJson>(request, baseUrl)); diff --git a/PlexRequests.Core/StatusChecker/StatusChecker.cs b/PlexRequests.Core/StatusChecker/StatusChecker.cs index cf009464b..9ed88f000 100644 --- a/PlexRequests.Core/StatusChecker/StatusChecker.cs +++ b/PlexRequests.Core/StatusChecker/StatusChecker.cs @@ -151,7 +151,7 @@ namespace PlexRequests.Core.StatusChecker var downloadLink = $"{AppveyorApiUrl}/buildjobs/{jobId}/artifacts/{artifactResult.fileName}"; var branchDisplay = EnumHelper.GetDisplayValue(branch); - var localVersion = AssemblyHelper.GetProductVersion(); + var localVersion = AssemblyHelper.GetFileVersion(); var localVersionExtended = $"{localVersion.Remove(localVersion.Length - 2, 2)}00"; var model = new StatusModel diff --git a/PlexRequests.Helpers/AssemblyHelper.cs b/PlexRequests.Helpers/AssemblyHelper.cs index ef342cc41..abdcfeeaf 100644 --- a/PlexRequests.Helpers/AssemblyHelper.cs +++ b/PlexRequests.Helpers/AssemblyHelper.cs @@ -45,5 +45,13 @@ namespace PlexRequests.Helpers var retVersion = fvi.ProductVersion; return retVersion; } + + public static string GetFileVersion() + { + var assembly = Assembly.GetExecutingAssembly(); + var fvi = FileVersionInfo.GetVersionInfo(assembly.Location); + var retVersion = fvi.FileVersion; + return retVersion; + } } } \ No newline at end of file diff --git a/PlexRequests.UI/Modules/LayoutModule.cs b/PlexRequests.UI/Modules/LayoutModule.cs index 03b3a95c6..3c1736dad 100644 --- a/PlexRequests.UI/Modules/LayoutModule.cs +++ b/PlexRequests.UI/Modules/LayoutModule.cs @@ -68,9 +68,9 @@ namespace PlexRequests.UI.Modules { return Response.AsJson(new JsonUpdateAvailableModel { UpdateAvailable = false }); } -#if DEBUG - return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false}); -#endif +//#if DEBUG + //return Response.AsJson(new JsonUpdateAvailableModel {UpdateAvailable = false}); +//#endif var checker = new StatusChecker(SystemSettings); var release = await Cache.GetOrSetAsync(CacheKeys.LastestProductVersion, async() => await checker.GetStatus(), 30);