2
0

Changed Job.ExecuteNow to ExecutionEnqueue

Instead of replacing progressToken, change Increments based in completed increments
This commit is contained in:
glax 2023-09-02 16:14:21 +02:00
parent 51a1ae72ca
commit c0e6da144e
2 changed files with 6 additions and 5 deletions

View File

@ -59,14 +59,15 @@ public abstract class Job : GlobalBase
public void ResetProgress() public void ResetProgress()
{ {
this.progressToken = new ProgressToken(this.progressToken.increments); this.progressToken.increments = this.progressToken.increments - this.progressToken.incrementsCompleted;
this.lastExecution = DateTime.Now; this.lastExecution = DateTime.Now;
} }
public void ExecuteNow() public void ExecutionEnqueue()
{ {
ResetProgress(); this.progressToken.increments = this.progressToken.increments - this.progressToken.incrementsCompleted;
this.lastExecution = DateTime.UnixEpoch; this.lastExecution = recurrenceTime is not null ? DateTime.Now.Subtract((TimeSpan)recurrenceTime) : DateTime.UnixEpoch;
this.progressToken.Standby();
} }
public void Cancel() public void Cancel()

View File

@ -130,7 +130,7 @@ public class JobBoss : GlobalBase
Queue<Job> connectorJobQueue = mangaConnectorJobQueue[job.mangaConnector]; Queue<Job> connectorJobQueue = mangaConnectorJobQueue[job.mangaConnector];
if(!connectorJobQueue.Contains(job)) if(!connectorJobQueue.Contains(job))
connectorJobQueue.Enqueue(job); connectorJobQueue.Enqueue(job);
job.ExecuteNow(); job.ExecutionEnqueue();
} }
public void AddJobsToQueue(IEnumerable<Job> jobs) public void AddJobsToQueue(IEnumerable<Job> jobs)