2
0

Fixed jobs not starting at all

This commit is contained in:
glax 2023-09-01 23:08:31 +02:00
parent 0552b3db82
commit eaab7c5235
2 changed files with 4 additions and 2 deletions

View File

@ -19,6 +19,8 @@ public abstract class Job : GlobalBase
this.recurring = recurring; this.recurring = recurring;
if (recurring && recurrenceTime is null) if (recurring && recurrenceTime is null)
throw new ArgumentException("If recurrence is set to true, a recurrence time has to be provided."); 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; this.recurrenceTime = recurrenceTime;
} }

View File

@ -130,13 +130,13 @@ public class JobBoss : GlobalBase
foreach (Queue<Job> jobQueue in mangaConnectorJobQueue.Values) foreach (Queue<Job> jobQueue in mangaConnectorJobQueue.Values)
{ {
Job queueHead = jobQueue.Peek(); Job queueHead = jobQueue.Peek();
if (queueHead.progressToken.state == ProgressToken.State.Complete) if (queueHead.progressToken.state is ProgressToken.State.Complete)
{ {
if(queueHead.recurring) if(queueHead.recurring)
queueHead.Reset(); queueHead.Reset();
jobQueue.Dequeue(); jobQueue.Dequeue();
}else if(queueHead.progressToken.state is ProgressToken.State.Standby)
AddJobsToQueue(jobQueue.Peek().ExecuteReturnSubTasks()); AddJobsToQueue(jobQueue.Peek().ExecuteReturnSubTasks());
} }
} }
} }
}