Fixed: TMDB Failing due to missing response header (#3610)

Qstick 5 years ago committed by GitHub
parent c27f08738a
commit df068e9f0a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

@ -86,11 +86,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
// The dude abides, so should us, Lets be nice to TMDb
// var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed
// var reset = long.Parse(response.Headers.GetValues("X-RateLimit-Reset").First()); // get time when it resets
var remaining = int.Parse(response.Headers.GetValues("X-RateLimit-Remaining").First());
if (remaining <= 5)
if (response.Headers.ContainsKey("X-RateLimit-Remaining"))
{
_logger.Trace("Waiting 5 seconds to get information for the next 35 movies");
Thread.Sleep(5000);
var remaining = int.Parse(response.Headers.GetValues("X-RateLimit-Remaining").First());
if (remaining <= 5)
{
_logger.Trace("Waiting 5 seconds to get information for the next 35 movies");
Thread.Sleep(5000);
}
}
var resource = response.Resource;
@ -333,11 +336,14 @@ namespace NzbDrone.Core.MetadataSource.SkyHook
// The dude abides, so should us, Lets be nice to TMDb
// var allowed = int.Parse(response.Headers.GetValues("X-RateLimit-Limit").First()); // get allowed
// var reset = long.Parse(response.Headers.GetValues("X-RateLimit-Reset").First()); // get time when it resets
var remaining = int.Parse(response.Headers.GetValues("X-RateLimit-Remaining").First());
if (remaining <= 5)
if (response.Headers.ContainsKey("X-RateLimit-Remaining"))
{
_logger.Trace("Waiting 5 seconds to get information for the next 35 movies");
Thread.Sleep(5000);
var remaining = int.Parse(response.Headers.GetValues("X-RateLimit-Remaining").First());
if (remaining <= 5)
{
_logger.Trace("Waiting 5 seconds to get information for the next 35 movies");
Thread.Sleep(5000);
}
}
var resources = response.Resource;

Loading…
Cancel
Save