|
|
@ -65,13 +65,15 @@ namespace NzbDrone.Core.Messaging.Commands
|
|
|
|
private void ExecuteCommand<TCommand>(TCommand command, CommandModel commandModel)
|
|
|
|
private void ExecuteCommand<TCommand>(TCommand command, CommandModel commandModel)
|
|
|
|
where TCommand : Command
|
|
|
|
where TCommand : Command
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var handlerContract = typeof(IExecute<>).MakeGenericType(command.GetType());
|
|
|
|
IExecute<TCommand> handler = null;
|
|
|
|
var handler = (IExecute<TCommand>)_serviceFactory.Build(handlerContract);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Trace("{0} -> {1}", command.GetType().Name, handler.GetType().Name);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
try
|
|
|
|
try
|
|
|
|
{
|
|
|
|
{
|
|
|
|
|
|
|
|
var handlerContract = typeof(IExecute<>).MakeGenericType(command.GetType());
|
|
|
|
|
|
|
|
handler = (IExecute<TCommand>)_serviceFactory.Build(handlerContract);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Trace("{0} -> {1}", command.GetType().Name, handler.GetType().Name);
|
|
|
|
|
|
|
|
|
|
|
|
_commandQueueManager.Start(commandModel);
|
|
|
|
_commandQueueManager.Start(commandModel);
|
|
|
|
BroadcastCommandUpdate(commandModel);
|
|
|
|
BroadcastCommandUpdate(commandModel);
|
|
|
|
|
|
|
|
|
|
|
@ -106,9 +108,12 @@ namespace NzbDrone.Core.Messaging.Commands
|
|
|
|
{
|
|
|
|
{
|
|
|
|
ProgressMessageContext.CommandModel = null;
|
|
|
|
ProgressMessageContext.CommandModel = null;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
_logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString());
|
|
|
|
if (handler != null)
|
|
|
|
|
|
|
|
{
|
|
|
|
|
|
|
|
_logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString());
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
private void BroadcastCommandUpdate(CommandModel command)
|
|
|
|
private void BroadcastCommandUpdate(CommandModel command)
|
|
|
|