From e063cf1fd904fa89b5000de3330744f4a41008de Mon Sep 17 00:00:00 2001 From: glax Date: Sat, 28 Jun 2025 23:15:51 +0200 Subject: [PATCH] Debug: MatchJobsRunningAndWaiting UpdateCoverJobs not starting. --- API/Tranga.cs | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/API/Tranga.cs b/API/Tranga.cs index ddeb873..8087e59 100644 --- a/API/Tranga.cs +++ b/API/Tranga.cs @@ -276,13 +276,17 @@ public static class Tranga private static List MatchJobsRunningAndWaiting(Dictionary>> running, Dictionary>> waiting) { + Log.Debug($"Matching {running.Count} running Jobs to {waiting.Count} waiting Jobs. Busy Connectors: {string.Join(", ", running.Select(r => r.Key))}"); DateTime start = DateTime.UtcNow; List ret = new(); + //Foreach MangaConnector foreach ((string connector, Dictionary> jobTypeJobsWaiting) in waiting) { + //Check if MangaConnector has a Job running if (running.TryGetValue(connector, out Dictionary>? jobTypeJobsRunning)) - { //MangaConnector has running Jobs - //Match per JobType + { + //MangaConnector has running Jobs + //Match per JobType (MangaConnector can have 1 Job per Type running at the same time) foreach ((JobType jobType, List jobsWaiting) in jobTypeJobsWaiting) { if(jobTypeJobsRunning.ContainsKey(jobType)) @@ -297,9 +301,13 @@ public static class Tranga } } else - { //MangaConnector has no running Jobs + { + //MangaConnector has no running Jobs foreach ((JobType jobType, List jobsWaiting) in jobTypeJobsWaiting) { + if(ret.Any(j => j.JobType == jobType)) + //Already a job of type to be started + continue; if (jobType is not JobType.DownloadSingleChapterJob) //If it is not a DownloadSingleChapterJob, just add the first ret.Add(jobsWaiting.First());