Closes #4759pull/5540/head
parent
07f0fbf9a5
commit
103ce3def4
@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(186)]
|
||||
public class add_result_to_commands : NzbDroneMigrationBase
|
||||
{
|
||||
protected override void MainDbUpgrade()
|
||||
{
|
||||
Alter.Table("Commands").AddColumn("Result").AsInt32().WithDefaultValue(1);
|
||||
}
|
||||
}
|
||||
}
|
@ -0,0 +1,9 @@
|
||||
namespace NzbDrone.Core.Messaging.Commands
|
||||
{
|
||||
public enum CommandResult
|
||||
{
|
||||
Unknown = 0,
|
||||
Successful = 1,
|
||||
Unsuccessful = 2
|
||||
}
|
||||
}
|
@ -0,0 +1,43 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
Loading…
Reference in new issue