File tree Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Expand file tree Collapse file tree 1 file changed +9
-2
lines changed Original file line number Diff line number Diff line change @@ -402,8 +402,15 @@ export default class XmppConnection extends Listenable {
402402
403403 // after connecting - immediately check whether shard changed,
404404 // we need this only when using websockets as bosh checks headers from every response
405- if ( this . _usesWebsocket && this . _oneSuccessfulConnect ) {
406- this . _keepAliveAndCheckShard ( ) ;
405+ if ( this . _usesWebsocket ) {
406+ if ( this . _oneSuccessfulConnect ) {
407+ // on reconnect we do it immediately
408+ this . _keepAliveAndCheckShard ( ) ;
409+ } else {
410+ // delay it a bit to not interfere with the connection process
411+ // and to allow backend to correct any possible split brain issues
412+ setTimeout ( ( ) => this . _keepAliveAndCheckShard ( ) , 5000 ) ;
413+ }
407414 }
408415 this . _oneSuccessfulConnect = true ;
409416
You can’t perform that action at this time.
0 commit comments