(cherry picked from commit 103ce3def4636ef891e72bd687ef8f46b5125233)pull/3600/head
parent
8f3aba7b79
commit
45329f29bd
@ -0,0 +1,14 @@
|
||||
using FluentMigrator;
|
||||
using NzbDrone.Core.Datastore.Migration.Framework;
|
||||
|
||||
namespace NzbDrone.Core.Datastore.Migration
|
||||
{
|
||||
[Migration(064)]
|
||||
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