Fix deletion of successful child tasks
This commit is contained in:
parent
7e4f43f1e2
commit
8737617e5f
@ -82,9 +82,8 @@ public class TaskManager
|
||||
}
|
||||
}
|
||||
|
||||
TrangaTask[] failedDownloadChapterTasks = _allTasks.Where(taskQuery =>
|
||||
taskQuery.state is TrangaTask.ExecutionState.Failed && taskQuery is DownloadChapterTask).ToArray();
|
||||
foreach (TrangaTask failedDownloadChapterTask in failedDownloadChapterTasks)
|
||||
foreach (TrangaTask failedDownloadChapterTask in _allTasks.Where(taskQuery =>
|
||||
taskQuery.state is TrangaTask.ExecutionState.Failed && taskQuery is DownloadChapterTask).ToArray())
|
||||
{
|
||||
DeleteTask(failedDownloadChapterTask);
|
||||
TrangaTask newTask = failedDownloadChapterTask.Clone();
|
||||
@ -92,13 +91,6 @@ public class TaskManager
|
||||
AddTask(newTask);
|
||||
}
|
||||
|
||||
TrangaTask[] successfulDownloadChapterTasks = _allTasks.Where(taskQuery =>
|
||||
taskQuery.state is TrangaTask.ExecutionState.Success && taskQuery is DownloadChapterTask).ToArray();
|
||||
foreach(TrangaTask successfulDownloadChapterTask in successfulDownloadChapterTasks)
|
||||
{
|
||||
DeleteTask(successfulDownloadChapterTask);
|
||||
}
|
||||
|
||||
if(waitingTasksCount != _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting))
|
||||
ExportDataAndSettings();
|
||||
waitingTasksCount = _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting);
|
||||
@ -166,6 +158,8 @@ public class TaskManager
|
||||
_runningDownloadChapterTasks[cRemoveTask].Cancel();
|
||||
_runningDownloadChapterTasks.Remove(cRemoveTask);
|
||||
}
|
||||
foreach(TrangaTask childTask in removeTask.childTasks)
|
||||
DeleteTask(childTask);
|
||||
}
|
||||
|
||||
public IEnumerable<TrangaTask> GetTasksMatching(TrangaTask.Task taskType, string? connectorName = null, string? searchString = null, string? internalId = null, string? chapterSortNumber = null)
|
||||
|
@ -75,6 +75,8 @@ public abstract class TrangaTask
|
||||
HttpStatusCode statusCode = ExecuteTask(taskManager, logger, cancellationToken);
|
||||
while(childTasks.Any(ct => ct.state is ExecutionState.Enqueued or ExecutionState.Running))
|
||||
Thread.Sleep(1000);
|
||||
foreach(TrangaTask childTask in this.childTasks.ToArray())
|
||||
taskManager.DeleteTask(childTask);
|
||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||
{
|
||||
this.lastExecuted = DateTime.Now;
|
||||
|
Loading…
Reference in New Issue
Block a user