additional cacher error handling + don't bother checking the requests when we don't get data back from plex

This commit is contained in:
Drewster727 2016-04-21 09:00:06 -05:00
commit ba06e8630f
4 changed files with 60 additions and 24 deletions

View file

@ -62,10 +62,17 @@ namespace PlexRequests.Services.Jobs
if (settings.Enabled)
{
Log.Trace("Getting all movies from CouchPotato");
var movies = CpApi.GetMovies(settings.FullUri, settings.ApiKey, new[] { "active" });
if (movies != null)
try
{
Cache.Set(CacheKeys.CouchPotatoQueued, movies, CacheKeys.TimeFrameMinutes.SchedulerCaching);
var movies = CpApi.GetMovies(settings.FullUri, settings.ApiKey, new[] { "active" });
if (movies != null)
{
Cache.Set(CacheKeys.CouchPotatoQueued, movies, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
catch (System.Exception ex)
{
Log.Error(ex, "Failed caching queued items from CouchPotato");
}
}
}