mirror of
https://github.com/lidarr/lidarr.git
synced 2025-08-20 21:43:33 -07:00
back to tiny for now
This commit is contained in:
parent
2912561d0e
commit
4deecde092
84 changed files with 617 additions and 558 deletions
|
@ -1,5 +1,6 @@
|
|||
using System;
|
||||
using System.Timers;
|
||||
using NLog;
|
||||
using NzbDrone.Common.Composition;
|
||||
using NzbDrone.Common.Messaging;
|
||||
using NzbDrone.Core.Lifecycle;
|
||||
|
@ -13,12 +14,14 @@ namespace NzbDrone.Core.Jobs
|
|||
{
|
||||
private readonly ITaskManager _taskManager;
|
||||
private readonly IMessageAggregator _messageAggregator;
|
||||
private readonly Logger _logger;
|
||||
private static readonly Timer Timer = new Timer();
|
||||
|
||||
public Scheduler(ITaskManager taskManager, IMessageAggregator messageAggregator)
|
||||
public Scheduler(ITaskManager taskManager, IMessageAggregator messageAggregator, Logger logger)
|
||||
{
|
||||
_taskManager = taskManager;
|
||||
_messageAggregator = messageAggregator;
|
||||
_logger = logger;
|
||||
}
|
||||
|
||||
public void Handle(ApplicationStartedEvent message)
|
||||
|
@ -34,10 +37,23 @@ namespace NzbDrone.Core.Jobs
|
|||
|
||||
foreach (var task in tasks)
|
||||
{
|
||||
var commandType = Type.GetType(task.Name);
|
||||
var command = (ICommand)Activator.CreateInstance(commandType);
|
||||
try
|
||||
{
|
||||
var commandType = Type.GetType(task.TypeName);
|
||||
var command = (ICommand)Activator.CreateInstance(commandType);
|
||||
|
||||
_messageAggregator.PublishCommand(command);
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
_logger.ErrorException("Error occured while execution task " + task.TypeName, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
_taskManager.SetLastExecutionTime(task.Id);
|
||||
}
|
||||
|
||||
|
||||
_messageAggregator.PublishCommand(command);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue