File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -1818,6 +1818,7 @@ socket.on('error', function (data) {
18181818 location . href = "./403" ;
18191819} ) ;
18201820var retryOnDisconnect = false ;
1821+ var retryTimer = null ;
18211822socket . on ( 'maintenance' , function ( data ) {
18221823 if ( data == version )
18231824 retryOnDisconnect = true ;
@@ -1830,14 +1831,19 @@ socket.on('disconnect', function (data) {
18301831 }
18311832 if ( ! editor . getOption ( 'readOnly' ) )
18321833 editor . setOption ( 'readOnly' , true ) ;
1833- if ( retryOnDisconnect )
1834- socket . connect ( ) ;
1834+ if ( retryOnDisconnect && ! retryTimer ) {
1835+ retryTimer = setInterval ( function ( ) {
1836+ socket . connect ( ) ;
1837+ } , 1000 ) ;
1838+ }
18351839} ) ;
18361840socket . on ( 'reconnect' , function ( data ) {
18371841 //sync back any change in offline
18381842 emitUserStatus ( true ) ;
18391843 cursorActivity ( ) ;
18401844 socket . emit ( 'online users' ) ;
1845+ clearInterval ( retryTimer ) ;
1846+ retryTimer = null ;
18411847 retryOnDisconnect = false ;
18421848} ) ;
18431849socket . on ( 'connect' , function ( data ) {
You can’t perform that action at this time.
0 commit comments