fix: WhatsApp-Polling als eigene Schleife statt APScheduler (kein Overlap mehr)

This commit is contained in:
2026-04-02 13:11:52 +02:00
parent e9f3d28554
commit 0dc718f541
2 changed files with 32 additions and 29 deletions

View File

@@ -20,7 +20,6 @@ from channels.whatsapp_channel import WhatsAppChannel
from config import settings
from db.database import init_db
from services import message_service
from tasks.receiver import build_scheduler
logging.basicConfig(
level=logging.INFO,
@@ -67,11 +66,7 @@ async def main(with_tui: bool = True) -> None:
await whatsapp.start()
await sms.start()
# 6. Hintergrund-Tasks starten (WhatsApp-Polling etc.)
scheduler = build_scheduler(whatsapp)
scheduler.start()
# 7. Uvicorn als Hintergrund-Task starten
# 6. Uvicorn als Hintergrund-Task starten
api_task = asyncio.create_task(_run_api(), name="mcm-api")
logger.info("API running on http://%s:%d", settings.host, settings.port)
@@ -91,7 +86,6 @@ async def main(with_tui: bool = True) -> None:
pass
finally:
logger.info("MCM shutting down…")
scheduler.shutdown(wait=False)
api_task.cancel()
try:
await api_task