From 3b61c7568e7eeae048e04e76d2d6d65936e6734d Mon Sep 17 00:00:00 2001 From: Simon Rettberg Date: Mon, 2 Jun 2014 20:02:31 +0200 Subject: Fix tracking of js taskmanager poller status; remove obsolete hack from taskmanager php api backend --- script/taskmanager.js | 10 +++++++--- 1 file changed, 7 insertions(+), 3 deletions(-) (limited to 'script') diff --git a/script/taskmanager.js b/script/taskmanager.js index 822d1421..c2305a2b 100644 --- a/script/taskmanager.js +++ b/script/taskmanager.js @@ -20,8 +20,9 @@ function tmInit() } item.prepend(''); }); - if (!tmIsRunning) + if (!tmIsRunning) { setTimeout(tmUpdate, 50); + } tmIsRunning = true; } @@ -35,8 +36,10 @@ function tmUpdate() return; active.push(id); }); - if (active.length === 0) + if (active.length === 0) { + tmIsRunning = false; return; + } $.post('api.php?do=taskmanager', {'ids[]': active, token: TOKEN}, function(data, status) { // POST success tmIsRunning = tmResult(data, status); @@ -47,8 +50,9 @@ function tmUpdate() // POST failure console.log("TaskManager Error: " + textStatus + " - " + errorThrown); tmIsRunning = (++tmErrors < TM_MAX_ERRORS); - if (tmIsRunning) + if (tmIsRunning) { setTimeout(tmUpdate, 2000); + } }); } -- cgit v1.2.3-55-g7522