1
0
mirror of https://github.com/Radarr/Radarr.git synced 2024-09-17 15:02:34 +02:00

Lock CommandQueueManager.PushMany too

This commit is contained in:
Taloth Saldono 2020-05-03 18:48:20 +02:00 committed by Qstick
parent 1fc49f2aa1
commit 4d1dbfe559

View File

@ -57,12 +57,14 @@ public List<CommandModel> PushMany<TCommand>(List<TCommand> commands)
{
_logger.Trace("Publishing {0} commands", commands.Count);
lock (_commandQueue)
{
var commandModels = new List<CommandModel>();
var existingCommands = _commandQueue.QueuedOrStarted();
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)
{
@ -91,6 +93,7 @@ public List<CommandModel> PushMany<TCommand>(List<TCommand> commands)
return commandModels;
}
}
public CommandModel Push<TCommand>(TCommand command, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified)
where TCommand : Command