mirror of
https://github.com/NodeBB/NodeBB.git
synced 2026-01-22 23:42:54 +01:00
fixed #2406
This commit is contained in:
11
loader.js
11
loader.js
@@ -42,6 +42,7 @@ Loader.init = function(callback) {
|
||||
|
||||
process.on('SIGHUP', Loader.restart);
|
||||
process.on('SIGUSR2', Loader.reload);
|
||||
process.on('SIGTERM', Loader.stop);
|
||||
callback();
|
||||
};
|
||||
|
||||
@@ -217,6 +218,16 @@ Loader.reload = function() {
|
||||
});
|
||||
};
|
||||
|
||||
Loader.stop = function() {
|
||||
Object.keys(cluster.workers).forEach(function(id) {
|
||||
// Gracefully close workers
|
||||
cluster.workers[id].kill();
|
||||
});
|
||||
|
||||
// Clean up the pidfile
|
||||
fs.unlinkSync(__dirname + '/pidfile');
|
||||
};
|
||||
|
||||
Loader.notifyWorkers = function (msg) {
|
||||
Object.keys(cluster.workers).forEach(function(id) {
|
||||
cluster.workers[id].send(msg);
|
||||
|
||||
Reference in New Issue
Block a user