handle losing connection to the webserver so we don't get stuck firing off loads of ajax requests
This commit is contained in:
parent
7053163f88
commit
4296344502
|
@ -74,6 +74,7 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
|
||||||
deluge.client.web.register_event_listener(eventName);
|
deluge.client.web.register_event_listener(eventName);
|
||||||
});
|
});
|
||||||
this.running = true;
|
this.running = true;
|
||||||
|
this.errorCount = 0;
|
||||||
this.getEvents();
|
this.getEvents();
|
||||||
},
|
},
|
||||||
|
|
||||||
|
@ -102,10 +103,14 @@ Deluge.EventsManager = Ext.extend(Ext.util.Observable, {
|
||||||
},
|
},
|
||||||
|
|
||||||
// private
|
// private
|
||||||
onGetEventsFailure: function(events) {
|
onGetEventsFailure: function(result, error) {
|
||||||
// the request timed out so we just want to open up another
|
// the request timed out or we had a communication failure
|
||||||
// one.
|
if (!this.running) return;
|
||||||
if (this.running) this.getEvents();
|
if (!error.isTimeout && this.errorCount++ >= 3) {
|
||||||
|
this.stop();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
this.getEvents();
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue