fix: WhatsApp-Polling als eigene Schleife statt APScheduler (kein Overlap mehr)
This commit is contained in:
8
main.py
8
main.py
@@ -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
|
||||
|
||||
Reference in New Issue
Block a user