mirror of
https://github.com/Ombi-app/Ombi.git
synced 2025-08-19 12:59:39 -07:00
Updated Polly
This commit is contained in:
parent
26e1d14812
commit
2c828ee54c
6 changed files with 171 additions and 167 deletions
|
@ -50,7 +50,7 @@ namespace PlexRequests.Api
|
|||
{
|
||||
RestRequest request;
|
||||
request = string.IsNullOrEmpty(profileId)
|
||||
? new RestRequest {Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}"}
|
||||
? new RestRequest { Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}" }
|
||||
: new RestRequest { Resource = "/api/{apikey}/movie.add?title={title}&identifier={imdbid}&profile_id={profileId}" };
|
||||
|
||||
if (!string.IsNullOrEmpty(profileId))
|
||||
|
@ -62,11 +62,11 @@ namespace PlexRequests.Api
|
|||
request.AddUrlSegment("imdbid", imdbid);
|
||||
request.AddUrlSegment("title", title);
|
||||
|
||||
var obj = RetryHandler.Execute(() => Api.ExecuteJson<JObject> (request, baseUrl),new[] {
|
||||
var obj = RetryHandler.Execute(() => Api.ExecuteJson<JObject>(request, baseUrl), new[] {
|
||||
TimeSpan.FromSeconds (2),
|
||||
TimeSpan.FromSeconds(5),
|
||||
TimeSpan.FromSeconds(10)},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan));
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling AddMovie for CP, Retrying {0}", timespan));
|
||||
|
||||
Log.Trace("CP movie Add result count {0}", obj.Count);
|
||||
|
||||
|
@ -106,18 +106,17 @@ namespace PlexRequests.Api
|
|||
request.AddUrlSegment("apikey", apiKey);
|
||||
|
||||
|
||||
var obj = RetryHandler.Execute<CouchPotatoStatus>(() => Api.Execute<CouchPotatoStatus> (request, url),new TimeSpan[] {
|
||||
var obj = RetryHandler.Execute<CouchPotatoStatus>(() => Api.Execute<CouchPotatoStatus>(request, url), new TimeSpan[] {
|
||||
TimeSpan.FromSeconds (2),
|
||||
TimeSpan.FromSeconds(5),
|
||||
TimeSpan.FromSeconds(10)},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetStatus for CP, Retrying {0}", timespan));
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetStatus for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
||||
public CouchPotatoProfiles GetProfiles(Uri url, string apiKey)
|
||||
{
|
||||
Log.Trace("Getting CP Profiles, ApiKey = {0}", apiKey);
|
||||
var request = new RestRequest
|
||||
{
|
||||
Resource = "api/{apikey}/profile.list/",
|
||||
|
@ -126,8 +125,8 @@ namespace PlexRequests.Api
|
|||
|
||||
request.AddUrlSegment("apikey", apiKey);
|
||||
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoProfiles> (request, url),null,
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetProfiles for CP, Retrying {0}", timespan));
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoProfiles>(request, url), null,
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetProfiles for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
|
@ -147,20 +146,20 @@ namespace PlexRequests.Api
|
|||
request.AddUrlSegment("status", string.Join(",", status));
|
||||
try
|
||||
{
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoMovies> (request, baseUrl),
|
||||
var obj = RetryHandler.Execute(() => Api.Execute<CouchPotatoMovies>(request, baseUrl),
|
||||
new[] {
|
||||
TimeSpan.FromSeconds (5),
|
||||
TimeSpan.FromSeconds(10),
|
||||
TimeSpan.FromSeconds(30)
|
||||
},
|
||||
(exception, timespan) => Log.Error (exception, "Exception when calling GetMovies for CP, Retrying {0}", timespan));
|
||||
(exception, timespan) => Log.Error(exception, "Exception when calling GetMovies for CP, Retrying {0}", timespan));
|
||||
|
||||
return obj;
|
||||
}
|
||||
catch (Exception e) // Request error is already logged in the ApiRequest class
|
||||
{
|
||||
Log.Error("Error when attempting to GetMovies.");
|
||||
Log.Error (e);
|
||||
Log.Error(e);
|
||||
return new CouchPotatoMovies();
|
||||
}
|
||||
}
|
||||
|
|
|
@ -35,6 +35,10 @@
|
|||
<HintPath>..\packages\NLog.4.3.4\lib\net45\NLog.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="Polly, Version=4.3.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Polly-Signed.4.3.0\lib\net45\Polly.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="RestSharp, Version=105.2.3.0, Culture=neutral, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\RestSharp.105.2.3\lib\net45\RestSharp.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
|
@ -59,9 +63,6 @@
|
|||
<Reference Include="TMDbLib, Version=0.9.0.0, Culture=neutral, PublicKeyToken=null">
|
||||
<HintPath>..\packages\TMDbLib.0.9.0.0-alpha\lib\net45\TMDbLib.dll</HintPath>
|
||||
</Reference>
|
||||
<Reference Include="Polly">
|
||||
<HintPath>..\packages\Polly-Signed.4.2.0\lib\net45\Polly.dll</HintPath>
|
||||
</Reference>
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="ApiRequest.cs" />
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
<package id="Nancy" version="1.4.3" targetFramework="net45" />
|
||||
<package id="Newtonsoft.Json" version="8.0.2" targetFramework="net45" />
|
||||
<package id="NLog" version="4.3.4" targetFramework="net45" />
|
||||
<package id="Polly-Signed" version="4.2.0" targetFramework="net45" />
|
||||
<package id="Polly-Signed" version="4.3.0" targetFramework="net45" />
|
||||
<package id="RestSharp" version="105.2.3" targetFramework="net45" />
|
||||
<package id="TMDbLib" version="0.9.0.0-alpha" targetFramework="net45" />
|
||||
</packages>
|
|
@ -28,6 +28,10 @@
|
|||
<Externalconsole>true</Externalconsole>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Polly, Version=4.3.0.0, Culture=neutral, PublicKeyToken=c8a3ffc3f8f825cc, processorArchitecture=MSIL">
|
||||
<HintPath>..\packages\Polly-Signed.4.3.0\lib\net45\Polly.dll</HintPath>
|
||||
<Private>True</Private>
|
||||
</Reference>
|
||||
<Reference Include="System" />
|
||||
<Reference Include="System.IO.Compression" />
|
||||
<Reference Include="System.IO.Compression.FileSystem" />
|
||||
|
|
|
@ -1,4 +1,4 @@
|
|||
<?xml version="1.0" encoding="utf-8"?>
|
||||
<packages>
|
||||
<package id="Polly-Signed" version="4.2.0" targetFramework="net45" />
|
||||
<package id="Polly-Signed" version="4.3.0" targetFramework="net45" />
|
||||
</packages>
|
Loading…
Add table
Add a link
Reference in a new issue