diff --git a/Tranga/Jobs/JobBoss.cs b/Tranga/Jobs/JobBoss.cs index 7248b45..3be3204 100644 --- a/Tranga/Jobs/JobBoss.cs +++ b/Tranga/Jobs/JobBoss.cs @@ -165,16 +165,7 @@ public class JobBoss : GlobalBase if(jobQueue.Count < 1) continue; Job queueHead = jobQueue.Peek(); - if (queueHead.progressToken.state is ProgressToken.State.Complete) - { - if(queueHead.recurring) - queueHead.ResetProgress(); - jobQueue.Dequeue(); - }else if (queueHead.progressToken.state is ProgressToken.State.Standby) - { - AddJobsToQueue(jobQueue.Peek().ExecuteReturnSubTasks()); - } - else if (queueHead.progressToken.state is ProgressToken.State.Cancelled) + if (queueHead.progressToken.state is ProgressToken.State.Complete or ProgressToken.State.Cancelled) { switch (queueHead) { @@ -187,6 +178,11 @@ public class JobBoss : GlobalBase break; } jobQueue.Dequeue(); + }else if (queueHead.progressToken.state is ProgressToken.State.Standby) + { + Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray(); + AddJobs(subJobs); + AddJobsToQueue(subJobs); } } } diff --git a/Tranga/Jobs/ProgressToken.cs b/Tranga/Jobs/ProgressToken.cs index 5661403..6624bc6 100644 --- a/Tranga/Jobs/ProgressToken.cs +++ b/Tranga/Jobs/ProgressToken.cs @@ -15,7 +15,7 @@ public class ProgressToken this.cancellationRequested = false; this.increments = increments; this.incrementsCompleted = 0; - this.state = State.Standby; + this.state = State.Complete; } private float GetProgress() @@ -32,6 +32,11 @@ public class ProgressToken state = State.Complete; } + public void Standby() + { + state = State.Standby; + } + public void Start() { state = State.Running;