add back edge case 0 memory restart and adapt tests

This commit is contained in:
Unitech 2015-06-11 10:56:39 +02:00
parent 8ae67614f3
commit c460ff76b6
2 changed files with 18 additions and 18 deletions

View File

@ -34,22 +34,22 @@ module.exports = function(God) {
return cb();
});
}
// else if (proc.pm2_env.status !== undefined &&
// proc_key.monit.memory !== undefined &&
// proc.pm2_env.status === cst.ONLINE_STATUS &&
// proc_key.monit.memory === 0 &&
// proc.pm2_env.exec_mode != 'fork_mode') {
// console.log('[PM2][WORKER] Process %s restarted because it uses 0 memory and has ONLINE status',
// proc.pm2_env.pm_id);
// God.restartProcessId({
// id: proc.pm2_env.pm_id,
// env: proc.pm2_env.env
// }, function(err, data) {
// if (err)
// console.error(err.stack || err);
// return cb();
// });
// }
else if (proc.pm2_env.status !== undefined &&
proc_key.monit.memory !== undefined &&
proc.pm2_env.status === cst.ONLINE_STATUS &&
proc_key.monit.memory === 0 &&
proc.pm2_env.exec_mode != 'fork_mode') {
console.log('[PM2][WORKER] Process %s restarted because it uses 0 memory and has ONLINE status',
proc.pm2_env.pm_id);
God.restartProcessId({
id: proc.pm2_env.pm_id,
env: proc.pm2_env.env
}, function(err, data) {
if (err)
console.error(err.stack || err);
return cb();
});
}
else {
return cb();
}

View File

@ -6,7 +6,7 @@ cd $file_path
echo -e "\033[1mRunning tests for json files :\033[0m"
$pm2 start all.json
PM2_WORKER_INTERVAL=90000 $pm2 start all.json
should 'should start processes' 'online' 6
$pm2 stop all.json
@ -51,7 +51,7 @@ $pm2 kill
########## JS style
$pm2 start configuration.json
PM2_WORKER_INTERVAL=90000 $pm2 start configuration.json
should 'should start processes' 'online' 6
$pm2 stop configuration.json