From a51adec836ae967a827cdddffc5572ef621b69d3 Mon Sep 17 00:00:00 2001 From: Gary Wilber Date: Fri, 2 Oct 2020 18:26:10 -0700 Subject: [PATCH] fix parallelism when set to 0 --- MediaBrowser.Controller/Entities/Folder.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/MediaBrowser.Controller/Entities/Folder.cs b/MediaBrowser.Controller/Entities/Folder.cs index 8cea8755cb..db59cdc314 100644 --- a/MediaBrowser.Controller/Entities/Folder.cs +++ b/MediaBrowser.Controller/Entities/Folder.cs @@ -564,6 +564,9 @@ namespace MediaBrowser.Controller.Entities progress.Report(childrenProgress.Average()); } + var fanoutConcurrency = ConfigurationManager.Configuration.LibraryScanFanoutConcurrency; + var parallelism = fanoutConcurrency == 0 ? Environment.ProcessorCount : fanoutConcurrency; + var actionBlock = new ActionBlock( async i => { @@ -588,7 +591,7 @@ namespace MediaBrowser.Controller.Entities }, new ExecutionDataflowBlockOptions { - MaxDegreeOfParallelism = ConfigurationManager.Configuration.LibraryScanFanoutConcurrency, + MaxDegreeOfParallelism = parallelism, CancellationToken = cancellationToken, });