Module: deluge Branch: master Commit: 429634450213c62c76ac954be186a455c81cf937
Author: Damien Churchill <[email protected]> Date: Wed Mar 31 14:43:30 2010 +0100 handle losing connection to the webserver so we don't get stuck firing off loads of ajax requests --- deluge/ui/web/js/deluge-all/EventsManager.js | 13 +++++++++---- 1 files changed, 9 insertions(+), 4 deletions(-) diff --git a/deluge/ui/web/js/deluge-all/EventsManager.js b/deluge/ui/web/js/deluge-all/EventsManager.js index 3ed9240..df669ff 100644 --- a/deluge/ui/web/js/deluge-all/EventsManager.js +++ b/deluge/ui/web/js/deluge-all/EventsManager.js @@ -74,6 +74,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { deluge.client.web.register_event_listener(eventName); }); this.running = true; + this.errorCount = 0; this.getEvents(); }, @@ -102,10 +103,14 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, { }, // private - onGetEventsFailure: function(events) { - // the request timed out so we just want to open up another - // one. - if (this.running) this.getEvents(); + onGetEventsFailure: function(result, error) { + // the request timed out or we had a communication failure + if (!this.running) return; + if (!error.isTimeout && this.errorCount++ >= 3) { + this.stop(); + return; + } + this.getEvents(); } }); -- You received this message because you are subscribed to the Google Groups "deluge-commit" group. To post to this group, send email to [email protected]. To unsubscribe from this group, send email to [email protected]. For more options, visit this group at http://groups.google.com/group/deluge-commit?hl=en.
