mirror of
https://github.com/zulip/zulip.git
synced 2025-11-04 05:53:43 +00:00
socket: Throttle reconnection attempts
Previously, if the user held down the enter button while the socket was disconnected, the client would try to connect in a very tight loop. Now we throttle reconnection attempts to 1 per second. (imported from commit 7b18260b992d5a34f3ea7925cf72b383f84bbabd)
This commit is contained in:
@@ -116,11 +116,11 @@ Socket.prototype = {
|
||||
};
|
||||
},
|
||||
|
||||
_do_reconnect: function Socket__do_reconnect() {
|
||||
_do_reconnect: _.throttle(function Socket__do_reconnect() {
|
||||
blueslip.info("Attempting socket reconnect.");
|
||||
this._sockjs = new SockJS(this.url, null, {protocols_whitelist: this._supported_protocols});
|
||||
this._setup_sockjs_callbacks(this._sockjs);
|
||||
},
|
||||
}, 1000),
|
||||
|
||||
_try_to_reconnect: function Socket__try_to_reconnect() {
|
||||
var that = this;
|
||||
|
||||
Reference in New Issue
Block a user