diff --git a/ecosystem.config.js b/ecosystem.config.js index 91b0d26..e861fcf 100644 --- a/ecosystem.config.js +++ b/ecosystem.config.js @@ -10,11 +10,21 @@ const DEPLOY_PATH = __dirname; // SHARED/requirements.txt (both bots also share BOTS/SHARED for code). const PY_INTERPRETER = `${DEPLOY_PATH}/../SHARED/.venv/bin/python`; +// Crash-loop governor: after max_restarts attempts that each fail to stay up +// min_uptime ms, PM2 marks the app `errored` and stops relaunching it, instead +// of restarting forever and pegging the CPU. See SREBOT/ecosystem.config.js. +const RESTART_POLICY = { + max_restarts: 10, + min_uptime: 10000, + exp_backoff_restart_delay: 200, +}; + module.exports = { apps: [ // Discord Bot { name: 'tssbot', + ...RESTART_POLICY, script: 'start_bot.py', interpreter: PY_INTERPRETER, cwd: DEPLOY_PATH,