Add parameter JobBoss to Job.ExecuteTask (and Internal)
This commit is contained in:
parent
391efcb9bc
commit
49ab8928b1
@ -27,7 +27,7 @@ public class DownloadChapter : Job
|
|||||||
return $"{id} Chapter: {chapter}";
|
return $"{id} Chapter: {chapter}";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal(JobBoss jobBoss)
|
||||||
{
|
{
|
||||||
Task downloadTask = new(delegate
|
Task downloadTask = new(delegate
|
||||||
{
|
{
|
||||||
|
@ -31,7 +31,7 @@ public class DownloadNewChapters : Job
|
|||||||
return $"{id} Manga: {manga}";
|
return $"{id} Manga: {manga}";
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal()
|
protected override IEnumerable<Job> ExecuteReturnSubTasksInternal(JobBoss jobBoss)
|
||||||
{
|
{
|
||||||
manga.SaveSeriesInfoJson(settings.downloadLocation);
|
manga.SaveSeriesInfoJson(settings.downloadLocation);
|
||||||
Chapter[] chapters = mangaConnector.GetNewChapters(manga, this.translatedLanguage);
|
Chapter[] chapters = mangaConnector.GetNewChapters(manga, this.translatedLanguage);
|
||||||
|
@ -86,13 +86,13 @@ public abstract class Job : GlobalBase
|
|||||||
subJob.Cancel();
|
subJob.Cancel();
|
||||||
}
|
}
|
||||||
|
|
||||||
public IEnumerable<Job> ExecuteReturnSubTasks()
|
public IEnumerable<Job> ExecuteReturnSubTasks(JobBoss jobBoss)
|
||||||
{
|
{
|
||||||
progressToken.Start();
|
progressToken.Start();
|
||||||
subJobs = ExecuteReturnSubTasksInternal();
|
subJobs = ExecuteReturnSubTasksInternal(jobBoss);
|
||||||
lastExecution = DateTime.Now;
|
lastExecution = DateTime.Now;
|
||||||
return subJobs;
|
return subJobs;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected abstract IEnumerable<Job> ExecuteReturnSubTasksInternal();
|
protected abstract IEnumerable<Job> ExecuteReturnSubTasksInternal(JobBoss jobBoss);
|
||||||
}
|
}
|
@ -253,7 +253,7 @@ public class JobBoss : GlobalBase
|
|||||||
Log($"Next job in {jobs.MinBy(job => job.nextExecution)?.nextExecution.Subtract(DateTime.Now)} {jobs.MinBy(job => job.nextExecution)?.id}");
|
Log($"Next job in {jobs.MinBy(job => job.nextExecution)?.nextExecution.Subtract(DateTime.Now)} {jobs.MinBy(job => job.nextExecution)?.id}");
|
||||||
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
|
}else if (queueHead.progressToken.state is ProgressToken.State.Standby)
|
||||||
{
|
{
|
||||||
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks().ToArray();
|
Job[] subJobs = jobQueue.Peek().ExecuteReturnSubTasks(this).ToArray();
|
||||||
AddJobs(subJobs);
|
AddJobs(subJobs);
|
||||||
AddJobsToQueue(subJobs);
|
AddJobsToQueue(subJobs);
|
||||||
}else if (queueHead.progressToken.state is ProgressToken.State.Running && DateTime.Now.Subtract(queueHead.progressToken.lastUpdate) > TimeSpan.FromMinutes(5))
|
}else if (queueHead.progressToken.state is ProgressToken.State.Running && DateTime.Now.Subtract(queueHead.progressToken.lastUpdate) > TimeSpan.FromMinutes(5))
|
||||||
|
Loading…
Reference in New Issue
Block a user