From 96928f52c197856c58027a547675d157fe204004 Mon Sep 17 00:00:00 2001 From: jjensenbloom <72892275+jjensenbloom@users.noreply.github.com> Date: Thu, 6 Jun 2024 23:47:01 -0700 Subject: [PATCH] Update God.js Only check the autostart parameter when the app doesn't exist already --- lib/God.js | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/lib/God.js b/lib/God.js index 1a8a3d13d..cf214a23d 100644 --- a/lib/God.js +++ b/lib/God.js @@ -186,6 +186,7 @@ God.executeApp = function executeApp(env, cb) { * 2 - Reset restart time and unstable_restarts * 3 - Assign a log file name depending on the id * 4 - If watch option is set, look for changes + * 5 - If autostart option is false, skip process start */ if (env_copy['pm_id'] === undefined) { env_copy['pm_id'] = God.getNewId(); @@ -207,16 +208,16 @@ God.executeApp = function executeApp(env, cb) { if (env_copy['watch']) { God.watch.enable(env_copy); } + + if (!env_copy['autostart']) { + var clu = {pm2_env: env_copy, process: {pid: 0}}; + God.clusters_db[env_copy.pm_id] = clu; + return cb(null, clu); + } } God.registerCron(env_copy) - if (env_copy['autostart'] === false) { - var clu = {pm2_env: env_copy, process: {pid: 0}}; - God.clusters_db[env_copy.pm_id] = clu; - return cb(null, clu); - } - /** Callback when application is launched */ var readyCb = function ready(proc) { // If vizion enabled run versioning retrieval system