Fixed timing issue allowing multiple instances of the same command to be queued
This commit is contained in:
parent
c8d2fcb223
commit
013c46d266
|
@ -96,8 +96,10 @@ namespace NzbDrone.Core.Messaging.Commands
|
||||||
_logger.Trace("Publishing {0}", command.Name);
|
_logger.Trace("Publishing {0}", command.Name);
|
||||||
_logger.Trace("Checking if command is queued or started: {0}", command.Name);
|
_logger.Trace("Checking if command is queued or started: {0}", command.Name);
|
||||||
|
|
||||||
|
lock (_commandQueue)
|
||||||
|
{
|
||||||
var existingCommands = QueuedOrStarted(command.Name);
|
var existingCommands = QueuedOrStarted(command.Name);
|
||||||
var existing = existingCommands.SingleOrDefault(c => CommandEqualityComparer.Instance.Equals(c.Body, command));
|
var existing = existingCommands.FirstOrDefault(c => CommandEqualityComparer.Instance.Equals(c.Body, command));
|
||||||
|
|
||||||
if (existing != null)
|
if (existing != null)
|
||||||
{
|
{
|
||||||
|
@ -123,6 +125,7 @@ namespace NzbDrone.Core.Messaging.Commands
|
||||||
|
|
||||||
return commandModel;
|
return commandModel;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CommandModel Push(string commandName, DateTime? lastExecutionTime, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified)
|
public CommandModel Push(string commandName, DateTime? lastExecutionTime, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified)
|
||||||
{
|
{
|
||||||
|
|
Loading…
Reference in New Issue