Skip to content

Commit

Permalink
Ensure increment_var value is a Number
Browse files Browse the repository at this point in the history
  • Loading branch information
watsonian committed Sep 6, 2022
1 parent 2573516 commit 25d21ee
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions lib/God.js
Original file line number Diff line number Diff line change
Expand Up @@ -560,12 +560,12 @@ God.injectVariables = function injectVariables (env, cb) {
return proc.pm2_env.name === env.name &&
typeof proc.pm2_env[env.increment_var] !== 'undefined';
}).map(function (proc) {
return proc.pm2_env[env.increment_var];
return Number(proc.pm2_env[env.increment_var]);
}).sort(function (a, b) {
return b - a;
})[0];
// inject a incremental variable
var defaut = env.env[env.increment_var] || 0;
var defaut = Number(env.env[env.increment_var]) || 0;
env[env.increment_var] = typeof lastIncrement === 'undefined' ? defaut : lastIncrement + 1;
env.env[env.increment_var] = env[env.increment_var];
}
Expand Down

0 comments on commit 25d21ee

Please sign in to comment.