Moved sucessstate to taskmanager

This commit is contained in:
glax 2023-06-28 22:43:46 +02:00
parent 98946b4aa3
commit a1202a875d
2 changed files with 16 additions and 4 deletions

View File

@ -88,6 +88,21 @@ public class TaskManager
_runningTasks[timedOutTask].Cancel();
timedOutTask.state = TrangaTask.ExecutionState.Failed;
}
foreach (TrangaTask finishedTask in _allTasks
.Where(taskQuery => taskQuery.state is TrangaTask.ExecutionState.Success).ToArray())
{
if(finishedTask is DownloadChapterTask)
{
DeleteTask(finishedTask);
finishedTask.state = TrangaTask.ExecutionState.Success;
}
else
{
finishedTask.state = TrangaTask.ExecutionState.Waiting;
this._runningTasks.Remove(finishedTask);
}
}
foreach (TrangaTask failedTask in _allTasks.Where(taskQuery =>
taskQuery.state is TrangaTask.ExecutionState.Failed).ToArray())

View File

@ -100,10 +100,7 @@ public abstract class TrangaTask
if ((int)statusCode >= 200 && (int)statusCode < 300)
{
this.lastExecuted = DateTime.Now;
if(this is DownloadChapterTask)
this.state = ExecutionState.Success;
else
this.state = ExecutionState.Waiting;
this.state = ExecutionState.Success;
}
else
{