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

pull/193/head
Drewster727 9 years ago
parent 076a75b82f
commit ba06e8630f

@ -62,12 +62,19 @@ namespace PlexRequests.Services.Jobs
if (settings.Enabled)
{
Log.Trace("Getting all movies from CouchPotato");
try
{
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");
}
}
}
// we do not want to set here...

@ -75,6 +75,13 @@ namespace PlexRequests.Services.Jobs
}
var libraries = CachedLibraries(authSettings, plexSettings, true); //force setting the cache (10 min intervals via scheduler)
if (libraries == null || !libraries.Any())
{
Log.Info("Did not find any libraries in Plex.");
return;
}
var movies = GetPlexMovies().ToArray();
var shows = GetPlexTvShows().ToArray();
var albums = GetPlexAlbums().ToArray();
@ -248,6 +255,8 @@ namespace PlexRequests.Services.Jobs
return results; // don't error out here, just let it go!
}
try
{
if (setCache)
{
Log.Trace("Plex Lib API Call");
@ -267,6 +276,12 @@ namespace PlexRequests.Services.Jobs
return GetLibraries(authSettings, plexSettings);
}, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
catch (Exception ex)
{
Log.Error(ex, "Failed to obtain Plex libraries");
}
return results;
}

@ -62,12 +62,19 @@ namespace PlexRequests.Services.Jobs
if (settings.Enabled)
{
Log.Trace("Getting all shows from SickRage");
try
{
var shows = SrApi.GetShows(settings.ApiKey, settings.FullUri);
if (shows != null)
{
Cache.Set(CacheKeys.SickRageQueued, shows.Result, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
catch (System.Exception ex)
{
Log.Error(ex, "Failed caching queued items from SickRage");
}
}
}
// we do not want to set here...

@ -63,12 +63,19 @@ namespace PlexRequests.Services.Jobs
if (settings.Enabled)
{
Log.Trace("Getting all tv series from Sonarr");
try
{
var series = SonarrApi.GetSeries(settings.ApiKey, settings.FullUri);
if (series != null)
{
Cache.Set(CacheKeys.SonarrQueued, series, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
catch (System.Exception ex)
{
Log.Error(ex, "Failed caching queued items from Sonarr");
}
}
}
// we do not want to set here...

Loading…
Cancel
Save