mirror of
https://github.com/C9Glax/tranga.git
synced 2025-01-12 11:27:32 +01:00
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 =>
|
foreach (TrangaTask failedDownloadChapterTask in _allTasks.Where(taskQuery =>
|
||||||
taskQuery.state is TrangaTask.ExecutionState.Failed && taskQuery is DownloadChapterTask).ToArray();
|
taskQuery.state is TrangaTask.ExecutionState.Failed && taskQuery is DownloadChapterTask).ToArray())
|
||||||
foreach (TrangaTask failedDownloadChapterTask in failedDownloadChapterTasks)
|
|
||||||
{
|
{
|
||||||
DeleteTask(failedDownloadChapterTask);
|
DeleteTask(failedDownloadChapterTask);
|
||||||
TrangaTask newTask = failedDownloadChapterTask.Clone();
|
TrangaTask newTask = failedDownloadChapterTask.Clone();
|
||||||
@ -92,13 +91,6 @@ public class TaskManager
|
|||||||
AddTask(newTask);
|
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))
|
if(waitingTasksCount != _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting))
|
||||||
ExportDataAndSettings();
|
ExportDataAndSettings();
|
||||||
waitingTasksCount = _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting);
|
waitingTasksCount = _allTasks.Count(task => task.state is TrangaTask.ExecutionState.Waiting);
|
||||||
@ -166,6 +158,8 @@ public class TaskManager
|
|||||||
_runningDownloadChapterTasks[cRemoveTask].Cancel();
|
_runningDownloadChapterTasks[cRemoveTask].Cancel();
|
||||||
_runningDownloadChapterTasks.Remove(cRemoveTask);
|
_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)
|
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);
|
HttpStatusCode statusCode = ExecuteTask(taskManager, logger, cancellationToken);
|
||||||
while(childTasks.Any(ct => ct.state is ExecutionState.Enqueued or ExecutionState.Running))
|
while(childTasks.Any(ct => ct.state is ExecutionState.Enqueued or ExecutionState.Running))
|
||||||
Thread.Sleep(1000);
|
Thread.Sleep(1000);
|
||||||
|
foreach(TrangaTask childTask in this.childTasks.ToArray())
|
||||||
|
taskManager.DeleteTask(childTask);
|
||||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||||
{
|
{
|
||||||
this.lastExecuted = DateTime.Now;
|
this.lastExecuted = DateTime.Now;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user