mirror of
https://github.com/C9Glax/tranga.git
synced 2025-07-03 17:34:17 +02:00
Removed DELETE Jobs/DownloadChapter and Jobs/MonitorManga. Can both be reached with DELETE Jobs (jobId)
Added POST Jobs/Cancel CancelJob and RemoveJob cancels/removes subJobs
This commit is contained in:
@ -11,6 +11,7 @@ public abstract class Job : GlobalBase
|
||||
public DateTime? lastExecution { get; private set; }
|
||||
public DateTime nextExecution => NextExecution();
|
||||
public string id => GetId();
|
||||
internal IEnumerable<Job>? subJobs { get; private set; }
|
||||
|
||||
public Job(GlobalBase clone, MangaConnector connector, bool recurring = false, TimeSpan? recurrenceTime = null) : base(clone)
|
||||
{
|
||||
@ -65,14 +66,17 @@ public abstract class Job : GlobalBase
|
||||
Log($"Cancelling {this}");
|
||||
this.progressToken.cancellationRequested = true;
|
||||
this.progressToken.Complete();
|
||||
if(subJobs is not null)
|
||||
foreach(Job subJob in subJobs)
|
||||
subJob.Cancel();
|
||||
}
|
||||
|
||||
public IEnumerable<Job> ExecuteReturnSubTasks()
|
||||
{
|
||||
progressToken.Start();
|
||||
IEnumerable<Job> ret = ExecuteReturnSubTasksInternal();
|
||||
subJobs = ExecuteReturnSubTasksInternal();
|
||||
lastExecution = DateTime.Now;
|
||||
return ret;
|
||||
return subJobs;
|
||||
}
|
||||
|
||||
protected abstract IEnumerable<Job> ExecuteReturnSubTasksInternal();
|
||||
|
Reference in New Issue
Block a user