Пример #1
0
        private async Task <Negotiator> GetScheduledJobs()
        {
            var s = await ScheduledJobSettings.GetSettingsAsync();

            var allJobs = await JobRecorder.GetJobsAsync();

            var jobsDict = allJobs.ToDictionary(k => k.Name, v => v.LastRun);
            var model    = new ScheduledJobsViewModel
            {
                CouchPotatoCacher       = s.CouchPotatoCacher,
                PlexAvailabilityChecker = s.PlexAvailabilityChecker,
                SickRageCacher          = s.SickRageCacher,
                SonarrCacher            = s.SonarrCacher,
                StoreBackup             = s.StoreBackup,
                StoreCleanup            = s.StoreCleanup,
                JobRecorder             = jobsDict
            };

            return(View["SchedulerSettings", model]);
        }
Пример #2
0
        private async Task <Negotiator> GetScheduledJobs()
        {
            var s = await ScheduledJobSettings.GetSettingsAsync();

            var allJobs = await JobRecorder.GetJobsAsync();

            var dict = new Dictionary <string, DateTime>();


            foreach (var j in allJobs)
            {
                DateTime dt;
                if (dict.TryGetValue(j.Name, out dt))
                {
                    // We already have the key... Somehow, we should have never got this record.
                }
                else
                {
                    dict.Add(j.Name, j.LastRun);
                }
            }

            var model = new ScheduledJobsViewModel
            {
                CouchPotatoCacher        = s.CouchPotatoCacher,
                PlexAvailabilityChecker  = s.PlexAvailabilityChecker,
                SickRageCacher           = s.SickRageCacher,
                SonarrCacher             = s.SonarrCacher,
                StoreBackup              = s.StoreBackup,
                StoreCleanup             = s.StoreCleanup,
                JobRecorder              = dict,
                RecentlyAddedCron        = s.RecentlyAddedCron,
                PlexContentCacher        = s.PlexContentCacher,
                FaultQueueHandler        = s.FaultQueueHandler,
                PlexEpisodeCacher        = s.PlexEpisodeCacher,
                PlexUserChecker          = s.PlexUserChecker,
                UserRequestLimitResetter = s.UserRequestLimitResetter
            };

            return(View["SchedulerSettings", model]);
        }