From 9cd94bba2a625ca433cd032960e2e7d3bad0dd21 Mon Sep 17 00:00:00 2001 From: Kenneth Skovhede Date: Fri, 19 Jul 2024 12:37:30 +0200 Subject: [PATCH] Separating the timers and callbacks --- .../webroot/ngax/scripts/services/ServerStatus.js | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/Duplicati/Server/webroot/ngax/scripts/services/ServerStatus.js b/Duplicati/Server/webroot/ngax/scripts/services/ServerStatus.js index b4fed78b5..b8dc85fbf 100644 --- a/Duplicati/Server/webroot/ngax/scripts/services/ServerStatus.js +++ b/Duplicati/Server/webroot/ngax/scripts/services/ServerStatus.js @@ -122,11 +122,13 @@ backupApp.service('ServerStatus', function ($rootScope, $timeout, AppService, Ap this.callWhenTaskCompletes = function (taskid, callback) { if (waitingfortask[taskid] == null) - { waitingfortask[taskid] = []; - // Guard against cases where the taks state is incorrectly reported - // This happens on really fast completion, and also sometimes on longer running tasks + waitingfortask[taskid].push(callback); + + // Guard against cases where the taks state is incorrectly reported + // This happens on really fast completion, and also sometimes on longer running tasks + if (waitingfortaskTimers[taskid] == null) { waitingfortaskTimers[taskid] = window.setInterval(() => { if (waitingfortask[taskid] == null) { @@ -141,8 +143,7 @@ backupApp.service('ServerStatus', function ($rootScope, $timeout, AppService, Ap checkTaskState(taskid); }, 1000); } - - waitingfortask[taskid].push(callback); + }; // This appears to be broken, and causes the UI to hang