You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
44 lines
1.0 KiB
44 lines
1.0 KiB
using NzbDrone.Core.ProgressMessaging;
|
|
|
|
namespace NzbDrone.Core.Messaging.Commands
|
|
{
|
|
public interface ICommandResultReporter
|
|
{
|
|
void Report(CommandResult result);
|
|
}
|
|
|
|
public class CommandResultReporter : ICommandResultReporter
|
|
{
|
|
private readonly IManageCommandQueue _commandQueueManager;
|
|
|
|
public CommandResultReporter(IManageCommandQueue commandQueueManager)
|
|
{
|
|
_commandQueueManager = commandQueueManager;
|
|
}
|
|
|
|
public void Report(CommandResult result)
|
|
{
|
|
var command = ProgressMessageContext.CommandModel;
|
|
|
|
if (command == null)
|
|
{
|
|
return;
|
|
}
|
|
|
|
if (!ProgressMessageContext.LockReentrancy())
|
|
{
|
|
return;
|
|
}
|
|
|
|
try
|
|
{
|
|
_commandQueueManager.SetResult(command, result);
|
|
}
|
|
finally
|
|
{
|
|
ProgressMessageContext.UnlockReentrancy();
|
|
}
|
|
}
|
|
}
|
|
}
|