fix: sauberer Shutdown (Telegram Updater, CancelledError), WhatsApp-Polling auf 5s

This commit is contained in:
2026-03-13 14:02:45 +01:00
parent d67479309d
commit 9046708015
3 changed files with 19 additions and 4 deletions

12
main.py
View File

@@ -85,14 +85,22 @@ async def main(with_tui: bool = True) -> None:
else:
# 8b. Nur API wartet auf Ctrl-C / SIGTERM
logger.info("Running in API-only mode (no TUI)")
await api_task
try:
await api_task
except asyncio.CancelledError:
pass
finally:
logger.info("MCM shutting down…")
scheduler.shutdown(wait=False)
api_task.cancel()
try:
await api_task
except asyncio.CancelledError:
pass
await telegram.stop()
await whatsapp.stop()
await sms.stop()
api_task.cancel()
logger.info("MCM stopped.")
if __name__ == "__main__":