mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-21 05:53:33 -07:00
improvements to scheduler,
better parallelism on RSS fetch
This commit is contained in:
parent
ff225e1753
commit
a816a83f3a
12 changed files with 114 additions and 29 deletions
|
@ -12,10 +12,9 @@ namespace NzbDrone.Core.Jobs
|
|||
public interface ITaskManager
|
||||
{
|
||||
IList<ScheduledTask> GetPending();
|
||||
void SetLastExecutionTime(int taskId);
|
||||
}
|
||||
|
||||
public class TaskManager : IHandle<ApplicationStartedEvent>, ITaskManager
|
||||
public class TaskManager : IHandle<ApplicationStartedEvent>, IHandleAsync<CommandExecutedEvent>, ITaskManager
|
||||
{
|
||||
private readonly IScheduledTaskRepository _scheduledTaskRepository;
|
||||
private readonly Logger _logger;
|
||||
|
@ -32,11 +31,6 @@ namespace NzbDrone.Core.Jobs
|
|||
return _scheduledTaskRepository.All().Where(c => c.LastExecution.AddMinutes(c.Interval) < DateTime.UtcNow).ToList();
|
||||
}
|
||||
|
||||
public void SetLastExecutionTime(int taskId)
|
||||
{
|
||||
_scheduledTaskRepository.SetLastExecutionTime(taskId, DateTime.UtcNow);
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
{
|
||||
var defaultTasks = new[]
|
||||
|
@ -72,5 +66,11 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
public void HandleAsync(CommandExecutedEvent message)
|
||||
{
|
||||
var commandId = _scheduledTaskRepository.GetDefinition(message.Command.GetType()).Id;
|
||||
_scheduledTaskRepository.SetLastExecutionTime(commandId, DateTime.UtcNow);
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue