diff --git a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs index e13d75eed..fceb7fed3 100644 --- a/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs +++ b/src/NzbDrone.Core/MetadataSource/SkyHook/SkyHookProxy.cs @@ -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;