Moved sucessstate to taskmanager
This commit is contained in:
parent
98946b4aa3
commit
a1202a875d
@ -89,6 +89,21 @@ public class TaskManager
|
|||||||
timedOutTask.state = TrangaTask.ExecutionState.Failed;
|
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 =>
|
foreach (TrangaTask failedTask in _allTasks.Where(taskQuery =>
|
||||||
taskQuery.state is TrangaTask.ExecutionState.Failed).ToArray())
|
taskQuery.state is TrangaTask.ExecutionState.Failed).ToArray())
|
||||||
{
|
{
|
||||||
|
@ -100,10 +100,7 @@ public abstract class TrangaTask
|
|||||||
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
if ((int)statusCode >= 200 && (int)statusCode < 300)
|
||||||
{
|
{
|
||||||
this.lastExecuted = DateTime.Now;
|
this.lastExecuted = DateTime.Now;
|
||||||
if(this is DownloadChapterTask)
|
|
||||||
this.state = ExecutionState.Success;
|
this.state = ExecutionState.Success;
|
||||||
else
|
|
||||||
this.state = ExecutionState.Waiting;
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
|
Loading…
x
Reference in New Issue
Block a user