From 12d53d52c0cffd1e4e84ed76c8e1a97454a695c6 Mon Sep 17 00:00:00 2001 From: ConfusedPolarBear <33811686+ConfusedPolarBear@users.noreply.github.com> Date: Mon, 16 May 2022 17:06:46 -0500 Subject: [PATCH] Add parallelism --- .../ScheduledTasks/FingerprinterTask.cs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs index 98980ac..1eccd9e 100644 --- a/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs +++ b/ConfusedPolarBear.Plugin.IntroSkipper/ScheduledTasks/FingerprinterTask.cs @@ -85,14 +85,14 @@ public class FingerprinterTask : IScheduledTask var queue = Plugin.Instance!.AnalysisQueue; var totalProcessed = 0; - foreach (var season in queue) + Parallel.ForEach(queue, (season) => { AnalyzeSeason(season, cancellationToken); // TODO: report progress on a per episode basis totalProcessed += season.Value.Count; progress.Report((totalProcessed * 100) / Plugin.Instance!.TotalQueued); - } + }); return Task.CompletedTask; }