import full eventflow project
This commit is contained in:
27
backend/fastapi_app/main.py
Normal file
27
backend/fastapi_app/main.py
Normal file
@@ -0,0 +1,27 @@
|
||||
import threading
|
||||
|
||||
from fastapi import FastAPI
|
||||
|
||||
from .routers import analyze, ingest, query
|
||||
from .services.retry_worker import run_retry_loop
|
||||
|
||||
app = FastAPI(title="eventflow-fastapi", version="0.1.0")
|
||||
|
||||
app.include_router(ingest.router, prefix="/ingest", tags=["ingest"])
|
||||
app.include_router(analyze.router, prefix="/analyze", tags=["analyze"])
|
||||
app.include_router(query.router, prefix="/query", tags=["query"])
|
||||
|
||||
|
||||
_stop = threading.Event()
|
||||
|
||||
|
||||
@app.on_event("startup")
|
||||
def _startup() -> None:
|
||||
# Background retry loop so transient gateway 5xx doesn't permanently stall parsing.
|
||||
t = threading.Thread(target=run_retry_loop, args=(_stop,), daemon=True)
|
||||
t.start()
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
def _shutdown() -> None:
|
||||
_stop.set()
|
||||
Reference in New Issue
Block a user