Make NetImport sync interval work (needs some testing)

This commit is contained in:
Devin Buhl
2017-01-28 14:59:21 -05:00
parent 4abbf55ee4
commit b6e4f53597
10 changed files with 102 additions and 347 deletions

View File

@@ -75,7 +75,6 @@ namespace NzbDrone.Core.Jobs
new ScheduledTask{ Interval = 5, TypeName = typeof(MessagingCleanupCommand).FullName},
new ScheduledTask{ Interval = updateInterval, TypeName = typeof(ApplicationUpdateCommand).FullName},
// new ScheduledTask{ Interval = 3*60, TypeName = typeof(UpdateSceneMappingCommand).FullName},
new ScheduledTask{ Interval = 12*60, TypeName = typeof(NetImportSyncCommand).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(HousekeepingCommand).FullName},
@@ -87,6 +86,12 @@ namespace NzbDrone.Core.Jobs
TypeName = typeof(RssSyncCommand).FullName
},
new ScheduledTask
{
Interval = GetNetImportSyncInterval(),
TypeName = typeof(NetImportSyncCommand).FullName
},
new ScheduledTask
{
Interval = _configService.DownloadedEpisodesScanInterval,
@@ -140,6 +145,23 @@ namespace NzbDrone.Core.Jobs
return interval;
}
private int GetNetImportSyncInterval()
{
var interval = _configService.NetImportSyncInterval;
if (interval > 0 && interval < 10)
{
return 10;
}
if (interval < 0)
{
return 0;
}
return interval;
}
public void Handle(CommandExecutedEvent message)
{
var scheduledTask = _scheduledTaskRepository.All().SingleOrDefault(c => c.TypeName == message.Command.Body.GetType().FullName);