Fix bug where ChildTasks hung parentTasks
This commit is contained in:
parent
7b311eae75
commit
604abd5f9a
@ -333,17 +333,16 @@ public class TaskManager
|
||||
this._allTasks = JsonConvert.DeserializeObject<HashSet<TrangaTask>>(buffer, new JsonSerializerSettings() { Converters = { new TrangaTask.TrangaTaskJsonConverter() } })!;
|
||||
}
|
||||
|
||||
foreach (TrangaTask task in this._allTasks.Where(tTask => tTask.parentTaskId is not null))
|
||||
foreach (TrangaTask task in this._allTasks.Where(tTask => tTask.parentTaskId is not null).ToArray())
|
||||
{
|
||||
TrangaTask? parentTask = this._allTasks.FirstOrDefault(pTask => pTask.taskId == task.parentTaskId);
|
||||
if (parentTask is not null)
|
||||
{
|
||||
task.parentTask = parentTask;
|
||||
parentTask.AddChildTask(task);
|
||||
this.DeleteTask(task);
|
||||
parentTask.lastExecuted = DateTime.UnixEpoch;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
if (File.Exists(settings.knownPublicationsPath))
|
||||
{
|
||||
logger?.WriteLine(this.GetType().ToString(), $"Importing known publications from {settings.knownPublicationsPath}");
|
||||
|
@ -72,7 +72,7 @@ public abstract class TrangaTask
|
||||
this.state = ExecutionState.Running;
|
||||
this.executionStarted = DateTime.Now;
|
||||
this.lastChange = DateTime.Now;
|
||||
if(parentTask is not null && parentTask.childTasks.All(ct => ct.state is ExecutionState.Waiting))
|
||||
if(parentTask is not null && parentTask.childTasks.All(ct => ct.state is ExecutionState.Waiting or ExecutionState.Failed))
|
||||
parentTask.executionStarted = DateTime.Now;
|
||||
|
||||
HttpStatusCode statusCode = ExecuteTask(taskManager, logger, cancellationToken);
|
||||
|
Loading…
Reference in New Issue
Block a user