increase the scheduler cache timeframe to avoid losing cache when the remote api endpoints go offline (due to a reboot or some other reason) -- if they're online, the cache will get refreshed every 10 minutes like normal

pull/193/head
Drewster727 9 years ago
parent 121465210d
commit 508baeec04

@ -30,7 +30,7 @@ namespace PlexRequests.Core
{
public struct TimeFrameMinutes
{
public const int SchedulerCaching = 10;
public const int SchedulerCaching = 60;
}
public const string PlexLibaries = "PlexLibaries";

@ -63,7 +63,10 @@ namespace PlexRequests.Services.Jobs
{
Log.Trace("Getting all movies from CouchPotato");
var movies = CpApi.GetMovies(settings.FullUri, settings.ApiKey, new[] { "active" });
Cache.Set(CacheKeys.CouchPotatoQueued, movies, CacheKeys.TimeFrameMinutes.SchedulerCaching);
if (movies != null)
{
Cache.Set(CacheKeys.CouchPotatoQueued, movies, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
}

@ -256,7 +256,10 @@ namespace PlexRequests.Services.Jobs
results = GetLibraries(authSettings, plexSettings);
Log.Trace("Plex Lib Cache Set Call");
Cache.Set(CacheKeys.PlexLibaries, results, CacheKeys.TimeFrameMinutes.SchedulerCaching);
if (results != null)
{
Cache.Set(CacheKeys.PlexLibaries, results, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
else
{

@ -62,8 +62,11 @@ namespace PlexRequests.Services.Jobs
if (settings.Enabled)
{
Log.Trace("Getting all shows from SickRage");
var movies = SrApi.GetShows(settings.ApiKey, settings.FullUri);
Cache.Set(CacheKeys.SickRageQueued, movies.Result, CacheKeys.TimeFrameMinutes.SchedulerCaching);
var shows = SrApi.GetShows(settings.ApiKey, settings.FullUri);
if (shows != null)
{
Cache.Set(CacheKeys.SickRageQueued, shows.Result, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
}

@ -64,7 +64,10 @@ namespace PlexRequests.Services.Jobs
{
Log.Trace("Getting all tv series from Sonarr");
var series = SonarrApi.GetSeries(settings.ApiKey, settings.FullUri);
Cache.Set(CacheKeys.SonarrQueued, series, CacheKeys.TimeFrameMinutes.SchedulerCaching);
if (series != null)
{
Cache.Set(CacheKeys.SonarrQueued, series, CacheKeys.TimeFrameMinutes.SchedulerCaching);
}
}
}

Loading…
Cancel
Save