2
0

Re-add task timeout

This commit is contained in:
glax 2023-06-27 22:19:06 +02:00
parent 9ccba6fba6
commit ba57282879

View File

@ -83,6 +83,14 @@ public class TaskManager
} }
} }
foreach (TrangaTask timedOutTask in _allTasks
.Where(taskQuery => taskQuery.lastChange.Add(TimeSpan.FromMinutes(3)) < DateTime.Now))
{
if(timedOutTask is DownloadChapterTask dct)
_runningDownloadChapterTasks[dct].Cancel();
timedOutTask.state = TrangaTask.ExecutionState.Failed;
}
foreach (TrangaTask failedDownloadChapterTask in _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())
{ {