@@ -56,8 +56,8 @@ var Polyglot = require('node-polyglot'),
5656 loadProfileNeeded = true ,
5757 startUpConnectMaxRetries = 4 ,
5858 startUpConnectRetryDelay = 2 * 1000 ,
59- startUpConnectMaxTime = 10 * 1000 ,
60- startTime = Date . now ( ) ,
59+ // startUpConnectMaxTime = 10 * 1000,
60+ // startTime = Date.now(),
6161 startUpRetry ,
6262 removeStartupRetry ,
6363 onActiveServerSync ,
@@ -527,6 +527,7 @@ $(document).ajaxSend(function(e, jqXhr) {
527527} ) ;
528528
529529$ ( document ) . ajaxError ( function ( event , jqxhr ) {
530+ console . log ( "ajax error" ) ;
530531 if ( jqxhr . status === 401 && jqxhr . serverConfig . id === app . serverConfigs . getActive ( ) . id ) {
531532 app . serverConnectModal . failConnection ( 'failed-auth' , jqxhr . serverConfig )
532533 . open ( ) ;
@@ -571,6 +572,7 @@ launchOnboarding = function(guidCreating) {
571572} ) ( ) ;
572573
573574pageConnectModal . on ( 'cancel' , ( ) => {
575+ console . log ( "page connect modal on cancel" ) ;
574576 removeStartupRetry ( ) ;
575577 app . getHeartbeatSocket ( ) . _socket . onclose = null ;
576578 app . getHeartbeatSocket ( ) . close ( ) ;
@@ -596,7 +598,9 @@ app.serverConnectModal.on('connected', () => {
596598app . getHeartbeatSocket ( ) . on ( 'open' , function ( ) {
597599 removeStartupRetry ( ) ;
598600 pageConnectModal . remove ( ) ;
599- startUpLoadingModal . open ( ) ;
601+ //startUpLoadingModal.open();
602+ console . log ( "heartbeat open" ) ;
603+ this . retryConnectionMsg && this . retryConnectionMsg . remove ( ) ;
600604
601605 if ( ! profileLoaded ) {
602606 // clear some flags so the heartbeat events will
@@ -609,27 +613,44 @@ app.getHeartbeatSocket().on('open', function() {
609613} ) ;
610614
611615app . getHeartbeatSocket ( ) . on ( 'close' , startUpRetry = function ( ) {
616+ console . log ( "heartbeat closed starupRetry" ) ;
617+ console . log ( startUpConnectMaxRetries ) ;
618+ /*
612619 if (
613620 Date.now() - startTime < startUpConnectMaxTime &&
614621 startUpConnectMaxRetries
622+ */
623+ if ( startUpConnectMaxRetries
615624 ) {
616625 startUpRetry . timeout = setTimeout ( ( ) => {
626+ console . log ( "retry connection" ) ;
617627 startUpConnectMaxRetries -- ;
618628 app . connectHeartbeatSocket ( ) ;
629+ this . retryConnectionMsg = this . retryConnectionMsg || app . statusBar . pushMessage ( {
630+ type : 'warning' ,
631+ msg : '<i>' + window . polyglot . t ( 'retryingConnection' ) + '</i>' ,
632+ duration : false
633+ } ) ;
619634 } , startUpConnectRetryDelay ) ;
620635 } else {
636+ console . log ( "connect retries exceeded" ) ;
637+ this . retryConnectionMsg && this . retryConnectionMsg . remove ( ) ;
621638 app . serverConnectModal . failConnection ( null , app . serverConfigs . getActive ( ) )
622639 . open ( ) ;
623640 }
624641} ) ;
625642
626643removeStartupRetry = function ( ) {
644+ startUpConnectMaxRetries = 4 ;
645+ /*
627646 clearTimeout(startUpRetry.timeout);
628647 app.getHeartbeatSocket().off('close', startUpRetry);
629648 app.getHeartbeatSocket().on('close', () => {
649+ console.log("removeStartupRetry close")
630650 app.serverConnectModal.failConnection(null, app.serverConfigs.getActive());
631651
632652 if (app.serverConnectModal.getConnectAttempt()) {
653+ console.log("get connect attempt")
633654 app.serverConnectModal.getConnectAttempt()
634655 .fail(() => {
635656 app.serverConnectModal.open();
@@ -638,6 +659,7 @@ removeStartupRetry = function() {
638659 app.serverConnectModal.open();
639660 }
640661 });
662+ */
641663} ;
642664
643665app . getHeartbeatSocket ( ) . on ( 'message' , function ( e ) {
0 commit comments