Fixed: Tasks Running at random times

pull/3295/head
Qstick 2 years ago
parent d999a4d582
commit da41220914

@ -9,8 +9,8 @@ namespace NzbDrone.Core.Jobs
public string TypeName { get; set; } public string TypeName { get; set; }
public int Interval { get; set; } public int Interval { get; set; }
public DateTime LastExecution { get; set; } public DateTime LastExecution { get; set; }
public DateTime LastStartTime { get; set; }
public CommandPriority Priority { get; set; } public CommandPriority Priority { get; set; }
public DateTime LastStartTime { get; set; }
public ScheduledTask() public ScheduledTask()
{ {

@ -199,7 +199,16 @@ namespace NzbDrone.Core.Jobs
if (scheduledTask != null && message.Command.Body.UpdateScheduledTask) if (scheduledTask != null && message.Command.Body.UpdateScheduledTask)
{ {
_logger.Trace("Updating last run time for: {0}", scheduledTask.TypeName); _logger.Trace("Updating last run time for: {0}", scheduledTask.TypeName);
_scheduledTaskRepository.SetLastExecutionTime(scheduledTask.Id, DateTime.UtcNow, message.Command.StartedAt.Value);
var lastExecution = DateTime.UtcNow;
var startTime = message.Command.StartedAt.Value;
_scheduledTaskRepository.SetLastExecutionTime(scheduledTask.Id, lastExecution, startTime);
var cached = _cache.Find(scheduledTask.TypeName);
cached.LastExecution = lastExecution;
cached.LastStartTime = startTime;
} }
} }

Loading…
Cancel
Save