diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml index 2d8fa6b..4cbed6a 100644 --- a/.gitea/workflows/deploy.yml +++ b/.gitea/workflows/deploy.yml @@ -29,4 +29,7 @@ jobs: git pull source .venv/bin/activate pip install -r requirements.txt - sudo systemctl restart tipibot + sudo systemctl restart tipibot_dev # dev bot first, as canary + sleep 5 + systemctl is-active --quiet tipibot_dev # dev crashed on startup -> abort + sudo systemctl restart tipibot # eco bot only if dev survived diff --git a/bot.py b/bot.py index 04a5682..b0f8a7e 100644 --- a/bot.py +++ b/bot.py @@ -373,7 +373,11 @@ async def _rotate_presence() -> None: except Exception as e: log.warning("Presence: failed to fetch economy count: %s", e) activity = _PRESENCES[_presence_index % len(_PRESENCES)](guild) - await bot.change_presence(status=discord.Status.online, activity=activity) + try: + await bot.change_presence(status=discord.Status.online, activity=activity) + except Exception as e: + # gateway may be mid-reconnect; skip this rotation instead of tracebacking + log.warning("Presence update skipped: %s", e) _presence_index += 1