mirror of
https://github.com/NodeBB/NodeBB.git
synced 2025-12-24 01:10:31 +01:00
Fix restarted secondary instances waiting forever for the templates:compiled message. Fix update notification always appearing when an instance restarts even if there was no update. Closes #4870 (#4871)
This commit is contained in:
11
loader.js
11
loader.js
@@ -29,7 +29,8 @@ var pidFilePath = __dirname + '/pidfile',
|
|||||||
css: {
|
css: {
|
||||||
cache: undefined,
|
cache: undefined,
|
||||||
acpCache: undefined
|
acpCache: undefined
|
||||||
}
|
},
|
||||||
|
templatesCompiled: false
|
||||||
};
|
};
|
||||||
|
|
||||||
Loader.init = function(callback) {
|
Loader.init = function(callback) {
|
||||||
@@ -112,6 +113,12 @@ Loader.addWorkerEvents = function(worker) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if (Loader.templatesCompiled && !worker.isPrimary) {
|
||||||
|
worker.send({
|
||||||
|
action: 'templates:compiled'
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
break;
|
break;
|
||||||
case 'restart':
|
case 'restart':
|
||||||
@@ -141,6 +148,8 @@ Loader.addWorkerEvents = function(worker) {
|
|||||||
}, worker.pid);
|
}, worker.pid);
|
||||||
break;
|
break;
|
||||||
case 'templates:compiled':
|
case 'templates:compiled':
|
||||||
|
Loader.templatesCompiled = true;
|
||||||
|
|
||||||
Loader.notifyWorkers({
|
Loader.notifyWorkers({
|
||||||
action: 'templates:compiled',
|
action: 'templates:compiled',
|
||||||
}, worker.pid);
|
}, worker.pid);
|
||||||
|
|||||||
@@ -56,8 +56,8 @@ app.cacheBuster = null;
|
|||||||
|
|
||||||
socket.removeAllListeners('event:nodebb.ready');
|
socket.removeAllListeners('event:nodebb.ready');
|
||||||
socket.on('event:nodebb.ready', function(data) {
|
socket.on('event:nodebb.ready', function(data) {
|
||||||
if (!app.cacheBusters || app.cacheBusters['cache-buster'] !== data['cache-buster']) {
|
if (!app.cacheBuster || app.cacheBuster !== data['cache-buster']) {
|
||||||
app.cacheBusters = data;
|
app.cacheBuster = data['cache-buster'];
|
||||||
|
|
||||||
app.alert({
|
app.alert({
|
||||||
alert_id: 'forum_updated',
|
alert_id: 'forum_updated',
|
||||||
|
|||||||
Reference in New Issue
Block a user