mirror of
https://github.com/lidarr/Lidarr
synced 2025-02-26 07:42:49 +00:00
Lock CommandQueueManager.PushMany too
This commit is contained in:
parent
8a68042192
commit
3964e98c13
1 changed files with 28 additions and 25 deletions
|
@ -57,12 +57,14 @@ public List<CommandModel> PushMany<TCommand>(List<TCommand> 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)
|
||||||
{
|
{
|
||||||
|
@ -91,6 +93,7 @@ public List<CommandModel> PushMany<TCommand>(List<TCommand> commands)
|
||||||
|
|
||||||
return commandModels;
|
return commandModels;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
public CommandModel Push<TCommand>(TCommand command, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified)
|
public CommandModel Push<TCommand>(TCommand command, CommandPriority priority = CommandPriority.Normal, CommandTrigger trigger = CommandTrigger.Unspecified)
|
||||||
where TCommand : Command
|
where TCommand : Command
|
||||||
|
|
Loading…
Reference in a new issue