From fa203c653ba5b7faa8bdd521ccc767b056e085fd Mon Sep 17 00:00:00 2001 From: deploy Date: Mon, 29 Jun 2026 12:58:56 +0000 Subject: [PATCH] pm2: add crash-loop governor to all apps; lower srebot max_memory_restart to 12000M Co-Authored-By: Claude Opus 4.8 --- ecosystem.config.js | 10 ++++++++++ 1 file changed, 10 insertions(+) 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,