From 8e92c55a35c80889915b134537347cd5de039618 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Wed, 6 Jan 2021 21:57:52 -0800 Subject: [PATCH] Better task interval fetching (cherry picked from commit fddf2d1fc8b600d8f82b2dbfd2376b0538c3cc83) --- src/NzbDrone.Core/Jobs/TaskManager.cs | 16 +++++++++++++--- 1 file changed, 13 insertions(+), 3 deletions(-) diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index 19e6645ba..bd1211a93 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -118,9 +118,19 @@ namespace NzbDrone.Core.Jobs private int GetBackupInterval() { - var interval = _configService.BackupInterval; + var intervalMinutes = _configService.BackupInterval; - return interval * 60 * 24; + if (intervalMinutes < 1) + { + intervalMinutes = 1; + } + + if (intervalMinutes > 7) + { + intervalMinutes = 7; + } + + return intervalMinutes * 60 * 24; } private int GetRssSyncInterval() @@ -154,7 +164,7 @@ namespace NzbDrone.Core.Jobs public void HandleAsync(ConfigSavedEvent message) { var rss = _scheduledTaskRepository.GetDefinition(typeof(RssSyncCommand)); - rss.Interval = _configService.RssSyncInterval; + rss.Interval = GetRssSyncInterval(); var backup = _scheduledTaskRepository.GetDefinition(typeof(BackupCommand)); backup.Interval = GetBackupInterval();