@@ -54,11 +54,12 @@ var Polyglot = require('node-polyglot'),
5454 PageConnectModal = require ( './views/pageConnectModal' ) ,
5555 Dialog = require ( './views/dialog.js' ) ,
5656 loadProfileNeeded = true ,
57- startUpConnectMaxRetries = 5 ,
58- starutUpConnectCurrentRetries = startUpConnectMaxRetries ,
59- startUpConnectRetryDelay = 3 * 1000 ,
57+ startUpConnectMaxRetries = 2 ,
58+ startUpConnectRetryDelay = 2 * 1000 ,
59+ startUpConnectMaxTime = 6 * 1000 ,
60+ startTime = Date . now ( ) ,
6061 startUpRetry ,
61- resetRetry ,
62+ removeStartupRetry ,
6263 onActiveServerSync ,
6364 newPageNavView ,
6465 newSocketView ,
@@ -570,7 +571,7 @@ launchOnboarding = function(guidCreating) {
570571} ) ( ) ;
571572
572573pageConnectModal . on ( 'cancel' , ( ) => {
573- resetRetry ( ) ;
574+ removeStartupRetry ( ) ;
574575 app . getHeartbeatSocket ( ) . _socket . onclose = null ;
575576 app . getHeartbeatSocket ( ) . close ( ) ;
576577 pageConnectModal . remove ( ) ;
@@ -593,10 +594,9 @@ app.serverConnectModal.on('connected', () => {
593594} ) ;
594595
595596app . getHeartbeatSocket ( ) . on ( 'open' , function ( ) {
596- resetRetry ( ) ;
597+ removeStartupRetry ( ) ;
597598 pageConnectModal . remove ( ) ;
598- //startUpLoadingModal.open();
599- this . retryConnectionMsg && this . retryConnectionMsg . remove ( ) ;
599+ startUpLoadingModal . open ( ) ;
600600
601601 if ( ! profileLoaded ) {
602602 // clear some flags so the heartbeat events will
@@ -609,33 +609,21 @@ app.getHeartbeatSocket().on('open', function() {
609609} ) ;
610610
611611app . getHeartbeatSocket ( ) . on ( 'close' , startUpRetry = function ( ) {
612- if ( starutUpConnectCurrentRetries
612+ if (
613+ Date . now ( ) - startTime < startUpConnectMaxTime &&
614+ startUpConnectMaxRetries
613615 ) {
614616 startUpRetry . timeout = setTimeout ( ( ) => {
615- var retryMsg = {
616- type : 'warning' ,
617- msg : '<i>' + window . polyglot . t ( 'errorMessages.retryingConnection' , { attempt : startUpConnectMaxRetries - starutUpConnectCurrentRetries + 1 , total : startUpConnectMaxRetries } ) + '</i>' ,
618- duration : false
619- } ;
620- starutUpConnectCurrentRetries -- ;
617+ startUpConnectMaxRetries -- ;
621618 app . connectHeartbeatSocket ( ) ;
622- if ( this . retryConnectionMsg ) {
623- this . retryConnectionMsg . updateMessage ( retryMsg ) ;
624- } else {
625- this . retryConnectionMsg = app . statusBar . pushMessage ( retryMsg ) ;
626- }
627619 } , startUpConnectRetryDelay ) ;
628620 } else {
629- this . retryConnectionMsg && this . retryConnectionMsg . remove ( ) ;
630621 app . serverConnectModal . failConnection ( null , app . serverConfigs . getActive ( ) )
631622 . open ( ) ;
632623 }
633624} ) ;
634625
635- resetRetry = function ( ) {
636- starutUpConnectCurrentRetries = startUpConnectMaxRetries ;
637- /* this code removed so the app will automatically reconnect when the internet connection is flaky */
638- /*
626+ removeStartupRetry = function ( ) {
639627 clearTimeout ( startUpRetry . timeout ) ;
640628 app . getHeartbeatSocket ( ) . off ( 'close' , startUpRetry ) ;
641629 app . getHeartbeatSocket ( ) . on ( 'close' , ( ) => {
@@ -650,7 +638,6 @@ resetRetry = function() {
650638 app . serverConnectModal . open ( ) ;
651639 }
652640 } ) ;
653- */
654641} ;
655642
656643app . getHeartbeatSocket ( ) . on ( 'message' , function ( e ) {
0 commit comments