TrangaTask Success-State and child task deletion

This commit is contained in:
glax 2023-06-27 23:55:13 +02:00
parent 16e3549455
commit 47a80d67a8

View File

@ -95,8 +95,6 @@ public abstract class TrangaTask
break; break;
} }
foreach(TrangaTask childTask in this.childTasks.ToArray())
taskManager.DeleteTask(childTask);
if ((int)statusCode >= 200 && (int)statusCode < 300) if ((int)statusCode >= 200 && (int)statusCode < 300)
{ {
@ -108,12 +106,13 @@ public abstract class TrangaTask
} }
else else
{ {
if (this is DownloadChapterTask && statusCode == HttpStatusCode.NotFound)
this.state = ExecutionState.Success;
else
this.state = ExecutionState.Failed; this.state = ExecutionState.Failed;
this.lastExecuted = DateTime.MaxValue; this.lastExecuted = DateTime.MaxValue;
} }
foreach (TrangaTask childTask in this.childTasks.Where(ct => ct is DownloadChapterTask).ToArray())
taskManager.DeleteTask(childTask);
logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}"); logger?.WriteLine(this.GetType().ToString(), $"Finished Executing Task {this}");
} }