From eaab7c5235300a591b7e77db64d8c030293982ce Mon Sep 17 00:00:00 2001 From: glax Date: Fri, 1 Sep 2023 23:08:31 +0200 Subject: [PATCH] Fixed jobs not starting at all --- Tranga/Jobs/Job.cs | 2 ++ Tranga/Jobs/JobBoss.cs | 4 ++-- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/Tranga/Jobs/Job.cs b/Tranga/Jobs/Job.cs index 4024b6d..a2ccbac 100644 --- a/Tranga/Jobs/Job.cs +++ b/Tranga/Jobs/Job.cs @@ -19,6 +19,8 @@ public abstract class Job : GlobalBase this.recurring = recurring; if (recurring && recurrenceTime is null) throw new ArgumentException("If recurrence is set to true, a recurrence time has to be provided."); + else if(recurring && recurrenceTime is not null) + this.lastExecution = DateTime.Now.Subtract((TimeSpan)recurrenceTime); this.recurrenceTime = recurrenceTime; } diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index 7d40268..004a349 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -130,13 +130,13 @@ public class JobBoss : GlobalBase foreach (Queue jobQueue in mangaConnectorJobQueue.Values) { Job queueHead = jobQueue.Peek(); - if (queueHead.progressToken.state == ProgressToken.State.Complete) + if (queueHead.progressToken.state is ProgressToken.State.Complete) { if(queueHead.recurring) queueHead.Reset(); jobQueue.Dequeue(); + }else if(queueHead.progressToken.state is ProgressToken.State.Standby) AddJobsToQueue(jobQueue.Peek().ExecuteReturnSubTasks()); - } } } } \ No newline at end of file