mirror of
https://github.com/Icinga/icingaweb2.git
synced 2025-04-08 17:15:08 +02:00
Merge pull request #2739 from Icinga/bugfix/icinga-timer-can-lock-up-the-browser-11693
Icinga.Timer: use setTimeout() instead of setInterval() (cherry picked from commit 74c90b8f7781796266a04873d7f6cfe3db6d733b) Signed-off-by: Eric Lippmann <eric.lippmann@icinga.com>
This commit is contained in:
parent
c427dba6af
commit
cee80b85c7
@ -41,6 +41,8 @@
|
||||
|
||||
|
||||
this.lastRuntime = [];
|
||||
|
||||
this.isRunning = false;
|
||||
};
|
||||
|
||||
Icinga.Timer.prototype = {
|
||||
@ -49,8 +51,16 @@
|
||||
* The initialization function starts our ticker
|
||||
*/
|
||||
initialize: function () {
|
||||
this.isRunning = true;
|
||||
|
||||
var _this = this;
|
||||
this.ticker = setInterval(function () { _this.tick(); }, this.interval);
|
||||
var f = function () {
|
||||
if (_this.isRunning) {
|
||||
_this.tick();
|
||||
setTimeout(f, _this.interval);
|
||||
}
|
||||
};
|
||||
f();
|
||||
},
|
||||
|
||||
/**
|
||||
@ -112,10 +122,7 @@
|
||||
* Our destroy function will clean up everything. Unused right now.
|
||||
*/
|
||||
destroy: function () {
|
||||
|
||||
if (this.ticker !== null) {
|
||||
clearInterval(this.ticker);
|
||||
}
|
||||
this.isRunning = false;
|
||||
|
||||
this.icinga = null;
|
||||
$.each(this.observers, function (idx, observer) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user