start coroutine from the thread instead of the wrapper normal func

This commit is contained in:
Viktor Barzin 2025-06-21 13:48:28 +00:00
parent 064f2651d5
commit 4e4a5ece15
No known key found for this signature in database
GPG key ID: 4056458DBDBF8863
2 changed files with 3 additions and 6 deletions

View file

@ -1,3 +1,4 @@
import asyncio
from pathlib import Path
import queue
from threading import Thread
@ -18,7 +19,7 @@ from ui_exporter import export_immoweb
app = FastAPI()
# Start worker thread
Thread(target=dump_listings_worker, daemon=True).start()
Thread(target=asyncio.run, args=[dump_listings_worker()], daemon=True).start()
# Allow CORS (for React frontend)
app.add_middleware(