Better task interval fetching

Fixes #706
Fixes #716
Fixes #705
This commit is contained in:
Qstick 2021-01-17 00:48:29 -05:00
parent 1756438fb0
commit f96424f4bd

View file

@ -120,6 +120,11 @@ private int GetBackupInterval()
{
var interval = _configService.BackupInterval;
if (interval < 1)
{
interval = 1;
}
return interval * 60 * 24;
}
@ -154,12 +159,12 @@ public void Handle(CommandExecutedEvent message)
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 = _configService.BackupInterval;
backup.Interval = GetBackupInterval();
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask>{ rss, backup });
_scheduledTaskRepository.UpdateMany(new List<ScheduledTask> { rss, backup });
}
}
}