1
0
Fork 0
mirror of https://github.com/Radarr/Radarr synced 2024-12-23 08:22:39 +00:00

Set update interval to 30 minutes if on nightly

This commit is contained in:
Leonardo Galli 2017-01-22 18:24:47 +01:00
parent de5489ae9a
commit a50b20a397

View file

@ -30,12 +30,14 @@ public class TaskManager : ITaskManager, IHandle<ApplicationStartedEvent>, IHand
{ {
private readonly IScheduledTaskRepository _scheduledTaskRepository; private readonly IScheduledTaskRepository _scheduledTaskRepository;
private readonly IConfigService _configService; private readonly IConfigService _configService;
private readonly IConfigFileProvider _configFileProvider;
private readonly Logger _logger; private readonly Logger _logger;
public TaskManager(IScheduledTaskRepository scheduledTaskRepository, IConfigService configService, Logger logger) public TaskManager(IScheduledTaskRepository scheduledTaskRepository, IConfigService configService, IConfigFileProvider configFileProvider, Logger logger)
{ {
_scheduledTaskRepository = scheduledTaskRepository; _scheduledTaskRepository = scheduledTaskRepository;
_configService = configService; _configService = configService;
_configFileProvider = configFileProvider;
_logger = logger; _logger = logger;
} }
@ -59,11 +61,18 @@ public DateTime GetNextExecution(Type type)
public void Handle(ApplicationStartedEvent message) public void Handle(ApplicationStartedEvent message)
{ {
float updateInterval = 6 * 60;
if (_configFileProvider.Branch == "nightly")
{
updateInterval = 30;
}
var defaultTasks = new[] var defaultTasks = new[]
{ {
new ScheduledTask{ Interval = 0.25f, TypeName = typeof(CheckForFinishedDownloadCommand).FullName}, new ScheduledTask{ Interval = 0.25f, TypeName = typeof(CheckForFinishedDownloadCommand).FullName},
new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).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 = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
new ScheduledTask{ Interval = 6*60, TypeName = typeof(CheckHealthCommand).FullName}, new ScheduledTask{ Interval = 6*60, TypeName = typeof(CheckHealthCommand).FullName},
new ScheduledTask{ Interval = 24*60, TypeName = typeof(RefreshMovieCommand).FullName}, new ScheduledTask{ Interval = 24*60, TypeName = typeof(RefreshMovieCommand).FullName},