From 554f6b4acc2c898eb26809857f65684278a50950 Mon Sep 17 00:00:00 2001 From: glax Date: Sun, 21 May 2023 01:58:24 +0200 Subject: [PATCH] TaskCheckerThread new logic --- Tranga/TaskManager.cs | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/Tranga/TaskManager.cs b/Tranga/TaskManager.cs index e7b6c2f..c73e55b 100644 --- a/Tranga/TaskManager.cs +++ b/Tranga/TaskManager.cs @@ -66,13 +66,11 @@ public class TaskManager //Check if previous tasks have finished and execute new tasks foreach (KeyValuePair> connectorTaskQueue in tasksToExecute) { - connectorTaskQueue.Value.RemoveAll(task => task.state == TrangaTask.ExecutionState.Waiting); - if (connectorTaskQueue.Value.Count > 0 && connectorTaskQueue.Value.All(task => - task.state is TrangaTask.ExecutionState.Running or TrangaTask.ExecutionState.Enqueued)) - { - ExecuteTaskNow(connectorTaskQueue.Value.First()); + if(connectorTaskQueue.Value.RemoveAll(task => task.state == TrangaTask.ExecutionState.Waiting) > 0) ExportData(Directory.GetCurrentDirectory()); - } + + if (connectorTaskQueue.Value.Count > 0 && connectorTaskQueue.Value.All(task => task.state is TrangaTask.ExecutionState.Enqueued)) + ExecuteTaskNow(connectorTaskQueue.Value.First()); } //Check if task should be executed