mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-10-26 08:36:12 +01:00
feat: #9135, don't try to reconnect forever
This commit is contained in:
@@ -150,5 +150,7 @@
|
||||
"useCompression": 0,
|
||||
"updateUrlWithPostIndex": 1,
|
||||
"composer:showHelpTab": 1,
|
||||
"composer:allowPluginHelp": 1
|
||||
"composer:allowPluginHelp": 1,
|
||||
"maxReconnectionAttempts": 5,
|
||||
"reconnectionDelay": 1500
|
||||
}
|
||||
@@ -208,6 +208,7 @@
|
||||
"already-blocked": "This user is already blocked",
|
||||
"already-unblocked": "This user is already unblocked",
|
||||
"no-connection": "There seems to be a problem with your internet connection",
|
||||
"socket-reconnect-failed": "Reconnect failed, please try again later",
|
||||
|
||||
"plugin-not-whitelisted": "Unable to install plugin – only plugins whitelisted by the NodeBB Package Manager can be installed via the ACP"
|
||||
}
|
||||
|
||||
@@ -409,6 +409,7 @@ ajaxify = window.ajaxify || {};
|
||||
|
||||
require(['translator', 'benchpress'], function (translator, Benchpress) {
|
||||
translator.translate('[[error:no-connection]]');
|
||||
translator.translate('[[error:socket-reconnect-failed]]');
|
||||
Benchpress.registerLoader(ajaxify.loadTemplate);
|
||||
Benchpress.setGlobal('config', config);
|
||||
});
|
||||
|
||||
@@ -45,8 +45,10 @@ socket = window.socket;
|
||||
socket.on('disconnect', onDisconnect);
|
||||
|
||||
socket.io.on('reconnect_failed', function () {
|
||||
// Wait ten times the reconnection delay and then start over
|
||||
setTimeout(socket.connect.bind(socket), parseInt(config.reconnectionDelay, 10) * 10);
|
||||
$('#reconnect-alert').removeClass('alert-warning')
|
||||
.addClass('alert-danger')
|
||||
.find('p')
|
||||
.translateText('[[error:socket-reconnect-failed]]');
|
||||
});
|
||||
|
||||
socket.on('checkSession', function (uid) {
|
||||
|
||||
@@ -49,8 +49,8 @@ apiController.loadConfig = async function (req) {
|
||||
socketioTransports,
|
||||
socketioOrigins,
|
||||
websocketAddress,
|
||||
maxReconnectionAttempts: meta.config.maxReconnectionAttempts || 5,
|
||||
reconnectionDelay: meta.config.reconnectionDelay || 1500,
|
||||
maxReconnectionAttempts: meta.config.maxReconnectionAttempts,
|
||||
reconnectionDelay: meta.config.reconnectionDelay,
|
||||
topicsPerPage: meta.config.topicsPerPage || 20,
|
||||
postsPerPage: meta.config.postsPerPage || 20,
|
||||
maximumFileSize: meta.config.maximumFileSize,
|
||||
|
||||
Reference in New Issue
Block a user