mirror of
https://github.com/Unitech/pm2.git
synced 2025-12-08 20:35:53 +00:00
add IPC message for fork mode - re enable process event monitoring - upgrade pm2-interface - upgrade pidusage for FreeBSD
This commit is contained in:
parent
2b6b8a7310
commit
87f48298bd
@ -58,7 +58,7 @@ require('./God/ActionMethods')(God);
|
||||
cluster.on('online', function(clu) {
|
||||
console.log('%s - id%d worker online', clu.pm2_env.pm_exec_path, clu.pm2_env.pm_id);
|
||||
clu.pm2_env.status = cst.ONLINE_STATUS;
|
||||
God.bus.emit('process:online', clu);
|
||||
God.bus.emit('process:online', { process : clu });
|
||||
});
|
||||
|
||||
cluster.on('exit', function(clu, code, signal) {
|
||||
@ -105,14 +105,14 @@ function handleExit(clu, exit_code) {
|
||||
console.log('Script %s had too many unstable restarts (%d). Stopped.',
|
||||
clu.pm2_env.pm_exec_path,
|
||||
clu.pm2_env.unstable_restarts);
|
||||
God.bus.emit('process:exit:overlimit', clu);
|
||||
God.bus.emit('process:exit:overlimit', { process : clu });
|
||||
clu.pm2_env.unstable_restarts = 0;
|
||||
clu.pm2_env.created_at = null;
|
||||
overlimit = true;
|
||||
}
|
||||
}
|
||||
|
||||
God.bus.emit('process:exit', clu);
|
||||
God.bus.emit('process:exit', { process : clu });
|
||||
|
||||
if (!stopping)
|
||||
clu.pm2_env.restart_time = clu.pm2_env.restart_time + 1;
|
||||
@ -173,7 +173,6 @@ God.executeApp = function(env, cb) {
|
||||
God.clusters_db[env_copy.pm_id] = clu;
|
||||
|
||||
clu.once('error', function(err) {
|
||||
console.log(err);
|
||||
clu.pm2_env_copy.status = cst.ERRORED_STATUS;
|
||||
});
|
||||
|
||||
@ -181,7 +180,7 @@ God.executeApp = function(env, cb) {
|
||||
handleExit(clu, code);
|
||||
});
|
||||
|
||||
God.bus.emit('process:online', clu);
|
||||
God.bus.emit('process:online', {process : clu });
|
||||
if (cb) cb(null, clu);
|
||||
|
||||
return false;
|
||||
|
||||
@ -52,7 +52,7 @@ module.exports = function(God) {
|
||||
switch (msg.type) {
|
||||
case 'uncaughtException':
|
||||
God.bus.emit('process:exception', {process : clu, data : msg.stack, err : msg.err});
|
||||
break;
|
||||
break;
|
||||
case 'log:out':
|
||||
God.bus.emit('log:out', {process : clu, data : msg.data});
|
||||
break;
|
||||
|
||||
@ -81,6 +81,13 @@ module.exports = function(God) {
|
||||
});
|
||||
});
|
||||
|
||||
cspr.on('message', function(data) {
|
||||
God.bus.emit(data.type ? data.type : 'process:msg', {
|
||||
process : cspr,
|
||||
data : data
|
||||
});
|
||||
});
|
||||
|
||||
fs.writeFileSync(pidFile, cspr.pid);
|
||||
|
||||
cspr.once('close', function(status) {
|
||||
|
||||
@ -40,7 +40,8 @@ var Interact = {
|
||||
switch (event) {
|
||||
case 'process:online':
|
||||
case 'process:exit':
|
||||
process_id = Filter.get_process_id(data.pm2_env.name,data.pm2_env.pm_id);
|
||||
case 'process:exit:overlimit':
|
||||
process_id = Filter.get_process_id(data.process.pm2_env.name, data.process.pm2_env.pm_id);
|
||||
data = Filter.filter_process_state_change(data);
|
||||
Interact.buffer_data(event, data, process_id);
|
||||
break;
|
||||
@ -330,13 +331,13 @@ var Filter = {
|
||||
/**
|
||||
* Filter data to send when process go online or offline
|
||||
*/
|
||||
filter_process_state_change : function(process) {
|
||||
filter_process_state_change : function(data) {
|
||||
var state = {
|
||||
state : process.pm2_env.status,
|
||||
name : process.pm2_env.name,
|
||||
pm_id : process.pm2_env.pm_id,
|
||||
restart_time : process.pm2_env.restart_time,
|
||||
uptime : process.pm2_env.uptime
|
||||
state : data.process.pm2_env.status,
|
||||
name : data.process.pm2_env.name,
|
||||
pm_id : data.process.pm2_env.pm_id,
|
||||
restart_time : data.process.pm2_env.restart_time,
|
||||
uptime : data.process.pm2_env.uptime
|
||||
};
|
||||
return state;
|
||||
},
|
||||
|
||||
@ -120,11 +120,11 @@ function exec(script, outFile, errFile) {
|
||||
type : 'uncaughtException',
|
||||
stack : err.stack,
|
||||
err : {
|
||||
type: err.type,
|
||||
stack: err.stack,
|
||||
arguments: err.arguments,
|
||||
message: err.message
|
||||
}
|
||||
type: err.type,
|
||||
stack: err.stack,
|
||||
arguments: err.arguments,
|
||||
message: err.message
|
||||
}
|
||||
});
|
||||
|
||||
if (!process.listeners('uncaughtException').filter(function (listener) {
|
||||
|
||||
@ -176,7 +176,7 @@ Satan.remoteWrapper = function() {
|
||||
God.bus.onAny(function(data) {
|
||||
debug(this.event);
|
||||
// Avoid circular structure
|
||||
pub.emit(this.event, Stringify(data));
|
||||
pub.emit(this.event, JSON.parse(Stringify(data)));
|
||||
});
|
||||
|
||||
};
|
||||
|
||||
@ -99,7 +99,7 @@
|
||||
"commander": "2.2.0",
|
||||
"cli-table": "0.3.0",
|
||||
"pm2-multimeter": "0.1.2",
|
||||
"pm2-interface": "0.1.1",
|
||||
"pm2-interface": "0.1.3",
|
||||
"pm2-axon-rpc": "0.0.2",
|
||||
"axon": "1.0.0",
|
||||
"cron": "1.0.1",
|
||||
@ -110,7 +110,7 @@
|
||||
"async": "0.7.0",
|
||||
"chokidar": "~0.8.2",
|
||||
"json-stringify-safe" : "*",
|
||||
"pidusage" : "*"
|
||||
"pidusage" : "0.0.4"
|
||||
},
|
||||
"devDependencies": {
|
||||
"mocha": "1.x",
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user