Comparing version
{ | ||
"name": "x-easy", | ||
"version": "2.11.3", | ||
"version": "2.12.0", | ||
"description": "Make simple and modular, building a web application with express.", | ||
@@ -5,0 +5,0 @@ "main": "index.js", |
@@ -72,2 +72,7 @@ # X-Easy | ||
constructor(app, modules) { | ||
// event called when the process is exiting | ||
app.callStop = () => { | ||
//... stopping worker | ||
} | ||
// method that receives messages from channels between processes | ||
@@ -74,0 +79,0 @@ app.addProcessMessageListener((channel, data) => { |
@@ -6,3 +6,24 @@ const fs = require('fs') | ||
const cluster = require('cluster') | ||
const stopSignals = [ | ||
'SIGHUP', | ||
'SIGINT', | ||
'SIGQUIT', | ||
'SIGILL', | ||
'SIGTRAP', | ||
'SIGABRT', | ||
'SIGBUS', | ||
'SIGFPE', | ||
'SIGUSR1', | ||
'SIGSEGV', | ||
'SIGUSR2', | ||
'SIGTERM' | ||
] | ||
stopSignals.forEach(signal => { | ||
process.on(signal, () => { | ||
console.info(signal, 'Stopping worker', cluster.worker.id) | ||
if (global.__app && typeof global.__app.callStop === 'function') global.__app.callStop() | ||
}) | ||
}) | ||
if (!global.__setConstantProperty) | ||
@@ -9,0 +30,0 @@ Object.defineProperty(global, '__setConstantProperty', { |
50335
1.35%11
10%528
3.94%171
3.01%