summaryrefslogtreecommitdiffstats
path: root/script
diff options
context:
space:
mode:
Diffstat (limited to 'script')
-rw-r--r--script/taskmanager.js10
1 files changed, 7 insertions, 3 deletions
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('<span class="data-tm-icon" />');
});
- 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);
+ }
});
}