1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-11-05 02:22:31 +01:00

Fixed: Broken tasks getting stuck in queue

This commit is contained in:
Mark McDowall 2020-03-05 17:57:11 -08:00 committed by Qstick
parent 5b6a6cc9dc
commit fd3acd85e6

View File

@ -67,13 +67,15 @@ private void ExecuteCommands()
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);
@ -108,10 +110,13 @@ private void ExecuteCommand<TCommand>(TCommand command, CommandModel commandMode
{ {
ProgressMessageContext.CommandModel = null; ProgressMessageContext.CommandModel = null;
} }
}
if (handler != null)
{
_logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString()); _logger.Trace("{0} <- {1} [{2}]", command.GetType().Name, handler.GetType().Name, commandModel.Duration.ToString());
} }
}
}
private void BroadcastCommandUpdate(CommandModel command) private void BroadcastCommandUpdate(CommandModel command)
{ {