From 8bddb1ae7ebb71cd39947238057aa13cfe0a6d95 Mon Sep 17 00:00:00 2001 From: Mark McDowall Date: Sun, 25 Dec 2022 23:20:43 -0800 Subject: [PATCH] Fixed: Multiple pushed releases will be processed sequentially (cherry picked from commit 1f8e1cf582f59fe1e8dcc0fad15afeed6d9cd9d1) --- src/Lidarr.Api.V1/Indexers/ReleasePushController.cs | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/src/Lidarr.Api.V1/Indexers/ReleasePushController.cs b/src/Lidarr.Api.V1/Indexers/ReleasePushController.cs index 494a9976d..1b027185f 100644 --- a/src/Lidarr.Api.V1/Indexers/ReleasePushController.cs +++ b/src/Lidarr.Api.V1/Indexers/ReleasePushController.cs @@ -1,5 +1,6 @@ using System.Collections.Generic; using System.Linq; +using System.Threading; using FluentValidation; using FluentValidation.Results; using Lidarr.Http; @@ -23,6 +24,8 @@ namespace Lidarr.Api.V1.Indexers private readonly IIndexerFactory _indexerFactory; private readonly Logger _logger; + private static readonly object PushLock = new object(); + public ReleasePushController(IMakeDownloadDecision downloadDecisionMaker, IProcessDownloadDecisions downloadDecisionProcessor, IIndexerFactory indexerFactory, @@ -54,8 +57,13 @@ namespace Lidarr.Api.V1.Indexers ResolveIndexer(info); - var decisions = _downloadDecisionMaker.GetRssDecision(new List { info }); - _downloadDecisionProcessor.ProcessDecisions(decisions); + List decisions; + + lock (PushLock) + { + decisions = _downloadDecisionMaker.GetRssDecision(new List { info }); + _downloadDecisionProcessor.ProcessDecisions(decisions); + } var firstDecision = decisions.FirstOrDefault();