setup boilerplate for creating background workers and add 1 for dumping listings
This commit is contained in:
parent
4e4a5ece15
commit
5bd4562205
2 changed files with 67 additions and 24 deletions
|
|
@ -6,7 +6,13 @@ from typing import Annotated
|
|||
import uuid
|
||||
from api.auth import get_current_user
|
||||
from api.config import DEV_TIER_ORIGINS, PROD_TIER_ORIGINS
|
||||
from api.worker import TaskStatus, dump_listings_worker, task_queue, task_results
|
||||
from api.worker import (
|
||||
DumpListingsWorker,
|
||||
TaskStatus,
|
||||
WorkerManager,
|
||||
task_queue,
|
||||
task_results,
|
||||
)
|
||||
from fastapi import Depends, FastAPI, HTTPException, Query
|
||||
from api.auth import User
|
||||
from models.listing import QueryParameters
|
||||
|
|
@ -19,7 +25,8 @@ from ui_exporter import export_immoweb
|
|||
app = FastAPI()
|
||||
|
||||
# Start worker thread
|
||||
Thread(target=asyncio.run, args=[dump_listings_worker()], daemon=True).start()
|
||||
WorkerManager(DumpListingsWorker()).start()
|
||||
|
||||
|
||||
# Allow CORS (for React frontend)
|
||||
app.add_middleware(
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue