fix parallelism when set to 0

This commit is contained in:
Gary Wilber 2020-10-02 18:26:10 -07:00
parent ac6d51554c
commit a51adec836

View File

@ -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<int>(
async i =>
{
@ -588,7 +591,7 @@ namespace MediaBrowser.Controller.Entities
},
new ExecutionDataflowBlockOptions
{
MaxDegreeOfParallelism = ConfigurationManager.Configuration.LibraryScanFanoutConcurrency,
MaxDegreeOfParallelism = parallelism,
CancellationToken = cancellationToken,
});