From a50b20a3975f1d37524829873fb6c8499d6e2b20 Mon Sep 17 00:00:00 2001 From: Leonardo Galli Date: Sun, 22 Jan 2017 18:24:47 +0100 Subject: [PATCH] Set update interval to 30 minutes if on nightly --- src/NzbDrone.Core/Jobs/TaskManager.cs | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/src/NzbDrone.Core/Jobs/TaskManager.cs b/src/NzbDrone.Core/Jobs/TaskManager.cs index 43af20db5..d5303a97c 100644 --- a/src/NzbDrone.Core/Jobs/TaskManager.cs +++ b/src/NzbDrone.Core/Jobs/TaskManager.cs @@ -30,12 +30,14 @@ public class TaskManager : ITaskManager, IHandle, IHand { private readonly IScheduledTaskRepository _scheduledTaskRepository; private readonly IConfigService _configService; + private readonly IConfigFileProvider _configFileProvider; private readonly Logger _logger; - public TaskManager(IScheduledTaskRepository scheduledTaskRepository, IConfigService configService, Logger logger) + public TaskManager(IScheduledTaskRepository scheduledTaskRepository, IConfigService configService, IConfigFileProvider configFileProvider, Logger logger) { _scheduledTaskRepository = scheduledTaskRepository; _configService = configService; + _configFileProvider = configFileProvider; _logger = logger; } @@ -59,11 +61,18 @@ public DateTime GetNextExecution(Type type) public void Handle(ApplicationStartedEvent message) { + float updateInterval = 6 * 60; + + if (_configFileProvider.Branch == "nightly") + { + updateInterval = 30; + } + var defaultTasks = new[] { new ScheduledTask{ Interval = 0.25f, TypeName = typeof(CheckForFinishedDownloadCommand).FullName}, new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).FullName}, - new ScheduledTask{ Interval = 6*60, TypeName = typeof(ApplicationUpdateCommand).FullName}, + new ScheduledTask{ Interval = updateInterval, TypeName = typeof(ApplicationUpdateCommand).FullName}, // new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName}, new ScheduledTask{ Interval = 6*60, TypeName = typeof(CheckHealthCommand).FullName}, new ScheduledTask{ Interval = 24*60, TypeName = typeof(RefreshMovieCommand).FullName},