|
|
@ -54,12 +54,14 @@ namespace NzbDrone.Core.Messaging.Commands
|
|
|
|
{
|
|
|
|
{
|
|
|
|
_logger.Trace("Publishing {0} commands", commands.Count);
|
|
|
|
_logger.Trace("Publishing {0} commands", commands.Count);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
lock (_commandQueue)
|
|
|
|
|
|
|
|
{
|
|
|
|
var commandModels = new List<CommandModel>();
|
|
|
|
var commandModels = new List<CommandModel>();
|
|
|
|
var existingCommands = _commandQueue.QueuedOrStarted();
|
|
|
|
var existingCommands = _commandQueue.QueuedOrStarted();
|
|
|
|
|
|
|
|
|
|
|
|
foreach (var command in commands)
|
|
|
|
foreach (var command in commands)
|
|
|
|
{
|
|
|
|
{
|
|
|
|
var existing = existingCommands.SingleOrDefault(c => c.Name == command.Name && CommandEqualityComparer.Instance.Equals(c.Body, command));
|
|
|
|
var existing = existingCommands.FirstOrDefault(c => c.Name == command.Name && CommandEqualityComparer.Instance.Equals(c.Body, command));
|
|
|
|
|
|
|
|
|
|
|
|
if (existing != null)
|
|
|
|
if (existing != null)
|
|
|
|
{
|
|
|
|
{
|
|
|
@ -88,6 +90,7 @@ namespace NzbDrone.Core.Messaging.Commands
|
|
|
|
|
|
|
|
|
|
|
|
return commandModels;
|
|
|
|
return commandModels;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
public CommandModel Push<TCommand>(TCommand command, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified) where TCommand : Command
|
|
|
|
public CommandModel Push<TCommand>(TCommand command, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified) where TCommand : Command
|
|
|
|
{
|
|
|
|
{
|
|
|
|