Skip to content

Commit

Permalink
Merge pull request #3584 from ngtmuzi/development
Browse files Browse the repository at this point in the history
Fix the bug: process with "restart-delay" can't restart when manually stop
  • Loading branch information
wallet77 committed Apr 3, 2018
2 parents 5290218 + c4c811e commit 33984b6
Showing 1 changed file with 7 additions and 5 deletions.
12 changes: 7 additions & 5 deletions lib/God/ActionMethods.js
Original file line number Diff line number Diff line change
Expand Up @@ -290,17 +290,19 @@ 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(God.clusters_db[id].pm2_env.restart_task);
clearTimeout(proc.pm2_env.restart_task);

if (God.clusters_db[id].pm2_env.status == cst.STOPPED_STATUS)
if (proc.pm2_env.status == cst.STOPPED_STATUS) {
proc.process.pid = 0;
return cb(null, God.getFormatedProcess(id));
}
// state == 'none' means that the process is not online yet
if (God.clusters_db[id].state && God.clusters_db[id].state === 'none')
if (proc.state && proc.state === 'none')
return setTimeout(function() { God.stopProcessId(id, cb); }, 250);

var proc = God.clusters_db[id];

console.log('Stopping app:%s id:%s', proc.pm2_env.name, proc.pm2_env.pm_id);
proc.pm2_env.status = cst.STOPPING_STATUS;

Expand Down

0 comments on commit 33984b6

Please sign in to comment.