Add parallelism

This commit is contained in:
ConfusedPolarBear 2022-05-16 17:06:46 -05:00
parent 08c6c48934
commit 12d53d52c0

View File

@ -85,14 +85,14 @@ public class FingerprinterTask : IScheduledTask
var queue = Plugin.Instance!.AnalysisQueue; var queue = Plugin.Instance!.AnalysisQueue;
var totalProcessed = 0; var totalProcessed = 0;
foreach (var season in queue) Parallel.ForEach(queue, (season) =>
{ {
AnalyzeSeason(season, cancellationToken); AnalyzeSeason(season, cancellationToken);
// TODO: report progress on a per episode basis // TODO: report progress on a per episode basis
totalProcessed += season.Value.Count; totalProcessed += season.Value.Count;
progress.Report((totalProcessed * 100) / Plugin.Instance!.TotalQueued); progress.Report((totalProcessed * 100) / Plugin.Instance!.TotalQueued);
} });
return Task.CompletedTask; return Task.CompletedTask;
} }