From 58db0494961ddced4ec082feac79e3f2008154dd Mon Sep 17 00:00:00 2001 From: glax Date: Thu, 24 Aug 2023 13:34:09 +0200 Subject: [PATCH] Merged MonitorJobs and CheckJobs in JobBoss --- Tranga/Jobs/JobBoss.cs | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index c05beae..34a6bd6 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -14,13 +14,6 @@ public class JobBoss : GlobalBase this.mangaConnectorJobQueue = new(); } - public void MonitorJobs() - { - foreach (Job job in jobs.Where(job => job.nextExecution < DateTime.Now && !QueueContainsJob(job)).OrderBy(job => job.nextExecution)) - AddJobToQueue(job); - CheckJobQueue(); - } - public void AddJob(Job job) { this.jobs.Add(job); @@ -53,8 +46,10 @@ public class JobBoss : GlobalBase AddJobToQueue(job); } - private void CheckJobQueue() + public void CheckJobs() { + foreach (Job job in jobs.Where(job => job.nextExecution < DateTime.Now && !QueueContainsJob(job)).OrderBy(job => job.nextExecution)) + AddJobToQueue(job); foreach (Queue jobQueue in mangaConnectorJobQueue.Values) { Job queueHead = jobQueue.Peek();