1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-10-06 08:07:20 +02:00

ScheduledTasks won't run immediately after first start

This commit is contained in:
markus101 2014-02-04 21:52:53 -08:00
parent f9b0b2206c
commit 16dd5b621e

View File

@ -57,7 +57,7 @@ public void Handle(ApplicationStartedEvent message)
new ScheduledTask{ Interval = 24*60, TypeName = typeof(HousekeepingCommand).FullName},
};
var currentTasks = _scheduledTaskRepository.All();
var currentTasks = _scheduledTaskRepository.All().ToList();
_logger.Debug("Initializing jobs. Available: {0} Existing:{1}", defaultTasks.Count(), currentTasks.Count());
@ -76,6 +76,11 @@ public void Handle(ApplicationStartedEvent message)
currentDefinition.Interval = defaultTask.Interval;
if (currentDefinition.Id == 0)
{
currentDefinition.LastExecution = DateTime.UtcNow;
}
_scheduledTaskRepository.Upsert(currentDefinition);
}
}