remove the connected call upon an update to reduce the number of ajax calls

This commit is contained in:
Damien Churchill 2009-11-04 19:54:59 +00:00
commit dd860e67f7
2 changed files with 158 additions and 166 deletions

View file

@ -95,16 +95,6 @@ Deluge.UI = {
scope: this scope: this
}); });
Deluge.Details.update(); Deluge.Details.update();
Deluge.Client.web.connected({
success: this.onConnectedCheck,
scope: this
});
},
onConnectedCheck: function(connected) {
if (!connected) {
Deluge.Events.fire('disconnect');
}
}, },
onUpdateError: function(error) { onUpdateError: function(error) {
@ -125,6 +115,7 @@ Deluge.UI = {
* Updates the various components in the interface. * Updates the various components in the interface.
*/ */
onUpdate: function(data) { onUpdate: function(data) {
if (!data['connected']) Deluge.Events.fire('disconnect');
Deluge.Torrents.update(data['torrents']); Deluge.Torrents.update(data['torrents']);
Deluge.Statusbar.update(data['stats']); Deluge.Statusbar.update(data['stats']);
Deluge.Sidebar.update(data['filters']); Deluge.Sidebar.update(data['filters']);
@ -189,7 +180,7 @@ Deluge.UI = {
if (this.running) { if (this.running) {
clearInterval(this.running); clearInterval(this.running);
this.running = false; this.running = false;
Deluge.Torrents.getStore().loadData([]); Deluge.Torrents.getStore().removeAll();
} }
} }
} }

View file

@ -457,6 +457,7 @@ class WebApi(JSONComponent):
""" """
d = Deferred() d = Deferred()
ui_info = { ui_info = {
"connected": client.connected(),
"torrents": None, "torrents": None,
"filters": None, "filters": None,
"stats": { "stats": {