diff options
Diffstat (limited to 'deluge/ui/web/js/deluge-all/ConnectionManager.js')
-rw-r--r-- | deluge/ui/web/js/deluge-all/ConnectionManager.js | 21 |
1 files changed, 17 insertions, 4 deletions
diff --git a/deluge/ui/web/js/deluge-all/ConnectionManager.js b/deluge/ui/web/js/deluge-all/ConnectionManager.js index 5261726fb..2e61e22a2 100644 --- a/deluge/ui/web/js/deluge-all/ConnectionManager.js +++ b/deluge/ui/web/js/deluge-all/ConnectionManager.js @@ -162,13 +162,23 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { }, update: function () { + this.updating = setTimeout(this.update, 2000); this.list.getStore().each(function (r) { deluge.client.web.get_host_status(r.id, { - success: this.onGetHostStatus, + success: this.onUpdate, scope: this, }); }, this); }, + onUpdate: function (host) { + if (!this.isVisible()) return; + this.onGetHostStatus(host); + + if (this.updating) { + clearTimeout(this.updating); + } + this.updating = setTimeout(this.update, 2000); + }, /** * Updates the buttons in the Connection Manager UI according to the @@ -312,7 +322,10 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { // private onHide: function () { - if (this.running) window.clearInterval(this.running); + if (this.updating) { + window.clearTimeout(this.updating); + this.updating = undefined; + } }, // private @@ -396,8 +409,8 @@ Deluge.ConnectionManager = Ext.extend(Ext.Window, { this.stopHostButton = bbar.items.get('cm-stop'); } this.loadHosts(); - if (this.running) return; - this.running = window.setInterval(this.update, 2000, this); + if (this.updating) return; + this.updating = window.setTimeout(this.update, 2000); }, // private |