Merge pull request #14215 from overleaf/jpa-slow-down-reconnecting

[web] slow down reconnecting to real-time on low-level errors

GitOrigin-RevId: cc7aba1f8fbc0fceb5dc66145009ba28c6236648
This commit is contained in:
Jakob Ackermann 2023-08-08 15:45:13 +02:00 committed by Copybot
parent 2e944a6230
commit d3c7ea9d32

View file

@ -150,7 +150,11 @@ export default ConnectionManager = (function () {
window.wsRetryHandshake &&
connectionAttempt++ < window.wsRetryHandshake
) {
return setTimeout(() => this.ide.socket.socket.connect(), 100)
return setTimeout(
() => this.ide.socket.socket.connect(),
// add jitter to spread reconnects
connectionAttempt * (1 + Math.random()) * 1000
)
}
this.updateConnectionManagerState('error')
sl_console.log('socket.io error', err)