Skip to content

Commit

Permalink
Fix restarted secondary instances waiting forever for the templates:c…
Browse files Browse the repository at this point in the history
…ompiled message. Fix update notification always appearing when an instance restarts even if there was no update. Closes NodeBB#4870 (NodeBB#4871)
  • Loading branch information
BenLubar authored and ralic committed Jul 22, 2016
1 parent 4127a98 commit 24b3aac
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 3 deletions.
11 changes: 10 additions & 1 deletion loader.js
Expand Up @@ -29,7 +29,8 @@ var pidFilePath = __dirname + '/pidfile',
css: {
cache: undefined,
acpCache: undefined
}
},
templatesCompiled: false
};

Loader.init = function(callback) {
Expand Down Expand Up @@ -101,6 +102,12 @@ Loader.addWorkerEvents = function(worker) {
});
}

if (Loader.templatesCompiled && !worker.isPrimary) {
worker.send({
action: 'templates:compiled'
});
}


break;
case 'restart':
Expand Down Expand Up @@ -130,6 +137,8 @@ Loader.addWorkerEvents = function(worker) {
}, worker.pid);
break;
case 'templates:compiled':
Loader.templatesCompiled = true;

Loader.notifyWorkers({
action: 'templates:compiled',
}, worker.pid);
Expand Down
4 changes: 2 additions & 2 deletions public/src/app.js
Expand Up @@ -56,8 +56,8 @@ app.cacheBuster = null;

socket.removeAllListeners('event:nodebb.ready');
socket.on('event:nodebb.ready', function(data) {
if (!app.cacheBusters || app.cacheBusters['cache-buster'] !== data['cache-buster']) {
app.cacheBusters = data;
if (!app.cacheBuster || app.cacheBuster !== data['cache-buster']) {
app.cacheBuster = data['cache-buster'];

app.alert({
alert_id: 'forum_updated',
Expand Down

0 comments on commit 24b3aac

Please sign in to comment.