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;
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;
}

View File

@ -130,13 +130,13 @@ public class JobBoss : GlobalBase
foreach (Queue<Job> 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());
}
}
}
}