Skip to content
This repository was archived by the owner on May 16, 2019. It is now read-only.

Commit fe74c69

Browse files
committed
Increase the heartbeat timeout to help with people who have to re-connect frequently.
1 parent 043f86f commit fe74c69

File tree

1 file changed

+14
-14
lines changed

1 file changed

+14
-14
lines changed

js/start.js

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -51,12 +51,12 @@ var Polyglot = require('node-polyglot'),
5151
ServerConfigsCl = require('./collections/serverConfigsCl'),
5252
ServerConnectModal = require('./views/serverConnectModal'),
5353
OnboardingModal = require('./views/onboardingModal'),
54-
PageConnectModal = require('./views/pageConnectModal'),
54+
PageConnectModal = require('./views/pageConnectModal'),
5555
Dialog = require('./views/dialog.js'),
5656
loadProfileNeeded = true,
57-
startUpConnectMaxRetries = 2,
57+
startUpConnectMaxRetries = 4,
5858
startUpConnectRetryDelay = 2 * 1000,
59-
startUpConnectMaxTime = 6 * 1000,
59+
startUpConnectMaxTime = 10 * 1000,
6060
startTime = Date.now(),
6161
startUpRetry,
6262
removeStartupRetry,
@@ -145,7 +145,7 @@ app.serverConfigs.fetch().done(() => {
145145
// old single config set-up (_serverConfig-1)
146146
if (oldConfig = localStorage['_serverConfig-1']) { // eslint-disable-line no-cond-assign
147147
oldConfig = JSON.parse(oldConfig);
148-
148+
149149
// don't create a ported connection if it's the same as the default one
150150
if (
151151
oldConfig.server_ip +
@@ -164,7 +164,7 @@ app.serverConfigs.fetch().done(() => {
164164
__.omit(oldConfig, ['local_username', 'local_password', 'id']),
165165
{ name: window.polyglot.t('serverConnectModal.portedConnectionName') }
166166
)
167-
).id
167+
).id
168168
);
169169
}
170170

@@ -177,14 +177,14 @@ app.serverConfigs.fetch().done(() => {
177177
} else {
178178
app.serverConfigs.setActive(defaultConfig.id);
179179
}
180-
}
180+
}
181181
});
182182

183183
ipcRenderer.send('activeServerChange', app.serverConfigs.getActive().toJSON());
184184

185185
app.serverConfigs.on('activeServerChange', (server) => {
186186
ipcRenderer.send('activeServerChange', server.toJSON());
187-
});
187+
});
188188

189189
//keep user and profile urls synced with the active server configuration
190190
(setServerUrl = function() {
@@ -422,7 +422,7 @@ var loadProfile = function(landingRoute, onboarded) {
422422
userProfile: userProfile,
423423
showDiscIntro: onboarded
424424
});
425-
425+
426426
newPageNavView.render();
427427

428428
app.chatVw = new ChatVw({
@@ -594,7 +594,7 @@ app.serverConnectModal.on('connected', () => {
594594
app.getHeartbeatSocket().on('open', function() {
595595
removeStartupRetry();
596596
pageConnectModal.remove();
597-
startUpLoadingModal.open();
597+
startUpLoadingModal.open();
598598

599599
if (!profileLoaded) {
600600
// clear some flags so the heartbeat events will
@@ -603,7 +603,7 @@ app.getHeartbeatSocket().on('open', function() {
603603
loadProfileNeeded = true;
604604
app.serverConnectModal.close();
605605
startUpLoadingModal.open();
606-
}
606+
}
607607
});
608608

609609
app.getHeartbeatSocket().on('close', startUpRetry = function() {
@@ -626,15 +626,15 @@ removeStartupRetry = function() {
626626
app.getHeartbeatSocket().off('close', startUpRetry);
627627
app.getHeartbeatSocket().on('close', () => {
628628
app.serverConnectModal.failConnection(null, app.serverConfigs.getActive());
629-
629+
630630
if (app.serverConnectModal.getConnectAttempt()) {
631631
app.serverConnectModal.getConnectAttempt()
632632
.fail(() => {
633633
app.serverConnectModal.open();
634634
});
635635
} else {
636636
app.serverConnectModal.open();
637-
}
637+
}
638638
});
639639
};
640640

@@ -692,7 +692,7 @@ app.getHeartbeatSocket().on('message', function(e) {
692692
app.serverConnectModal.failConnection(
693693
data.reason === 'too many attempts' ? 'failed-auth-too-many' : 'failed-auth',
694694
app.serverConfigs.getActive()
695-
).open();
695+
).open();
696696
}
697697
}).fail(function() {
698698
app.serverConnectModal.failConnection(null, app.serverConfigs.getActive())
@@ -715,4 +715,4 @@ app.getHeartbeatSocket().on('message', function(e) {
715715
}
716716
}
717717
});
718-
// end - server connection and app initialization flow
718+
// end - server connection and app initialization flow

0 commit comments

Comments
 (0)