fix the "restart_task" enumerable problem.

This commit is contained in:
xuezhongxiong 2017-02-16 17:55:51 +08:00
parent 79de7657bc
commit bb31516d81
2 changed files with 5 additions and 5 deletions

View File

@ -338,6 +338,8 @@ God.handleExit = function handleExit(clu, exit_code, kill_signal) {
}
if (!stopping && !overlimit) {
//make this property unenumerable
Object.defineProperty(proc.pm2_env, 'restart_task', {configurable: true, writable: true});
proc.pm2_env.restart_task = setTimeout(function() {
proc.pm2_env.restart_time += 1;
God.executeApp(proc.pm2_env);

View File

@ -242,15 +242,13 @@ module.exports = function(God) {
if (!(id in God.clusters_db))
return cb(God.logAndGenerateError(id + ' : id unknown'), {});
var proc = God.clusters_db[id];
//clear time-out restart task
clearTimeout(proc.pm2_env.restart_task);
clearTimeout(God.clusters_db[id].pm2_env.restart_task);
if (proc.pm2_env.status == cst.STOPPED_STATUS)
if (God.clusters_db[id].pm2_env.status == cst.STOPPED_STATUS)
return cb(null, God.getFormatedProcess(id));
// state == 'none' means that the process is not online yet
if (proc.state && proc.state === 'none')
if (God.clusters_db[id].state && God.clusters_db[id].state === 'none')
return setTimeout(function() { God.stopProcessId(id, cb); }, 250);
var proc = God.clusters_db[id];