fix: sauberer Shutdown (Telegram Updater, CancelledError), WhatsApp-Polling auf 5s
This commit is contained in:
12
main.py
12
main.py
@@ -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__":
|
||||
|
||||
Reference in New Issue
Block a user