diff --git a/PiwigoDirectorySync/Services/FileIndexer.cs b/PiwigoDirectorySync/Services/FileIndexer.cs index 7814920..386c131 100644 --- a/PiwigoDirectorySync/Services/FileIndexer.cs +++ b/PiwigoDirectorySync/Services/FileIndexer.cs @@ -26,7 +26,7 @@ internal class FileIndexer : IFileIndexer { var parallelOptions = new ParallelOptions { - MaxDegreeOfParallelism = Environment.ProcessorCount, + MaxDegreeOfParallelism = Math.Min(Environment.ProcessorCount, 8), CancellationToken = ct }; await Parallel.ForEachAsync(fileQueue.Reader.ReadAllAsync(ct), parallelOptions,