From 4c6c0ae900ba09348c3a7b9901e4f16221b8d248 Mon Sep 17 00:00:00 2001 From: Drewster727 Date: Thu, 14 Apr 2016 23:06:42 -0500 Subject: [PATCH] cache plex library data regardless of whether we have requests in the database or not --- .../PlexAvailabilityChecker.cs | 21 ++++++++++++------- 1 file changed, 13 insertions(+), 8 deletions(-) diff --git a/PlexRequests.Services/PlexAvailabilityChecker.cs b/PlexRequests.Services/PlexAvailabilityChecker.cs index 810123cec..40da825be 100644 --- a/PlexRequests.Services/PlexAvailabilityChecker.cs +++ b/PlexRequests.Services/PlexAvailabilityChecker.cs @@ -35,7 +35,6 @@ using PlexRequests.Core; using PlexRequests.Core.SettingModels; using PlexRequests.Helpers; -using PlexRequests.Helpers.Exceptions; using PlexRequests.Services.Interfaces; using PlexRequests.Store; using PlexRequests.Services.Models; @@ -67,14 +66,10 @@ public void CheckAndUpdateAll(long check) var plexSettings = Plex.GetSettings(); var authSettings = Auth.GetSettings(); Log.Trace("Getting all the requests"); - var requests = RequestService.GetAll(); - - var requestedModels = requests as RequestedModel[] ?? requests.Where(x => !x.Available).ToArray(); - Log.Trace("Requests Count {0}", requestedModels.Length); - - if (!ValidateSettings(plexSettings, authSettings) || !requestedModels.Any()) + + if (!ValidateSettings(plexSettings, authSettings)) { - Log.Info("Validation of the settings failed or there is no requests."); + Log.Info("Validation of the plex settings failed."); return; } @@ -83,6 +78,16 @@ public void CheckAndUpdateAll(long check) var shows = GetPlexTvShows().ToArray(); var albums = GetPlexAlbums().ToArray(); + var requests = RequestService.GetAll(); + var requestedModels = requests as RequestedModel[] ?? requests.Where(x => !x.Available).ToArray(); + Log.Trace("Requests Count {0}", requestedModels.Length); + + if (!requestedModels.Any()) + { + Log.Info("There are no requests to check."); + return; + } + var modifiedModel = new List(); foreach (var r in requestedModels) {