manual submit
This commit is contained in:
11
web/app.py
11
web/app.py
@@ -178,6 +178,7 @@ def create_app() -> FastAPI:
|
||||
from web.routers.share_router import router as share_router
|
||||
from web.routers.workflow_router import router as workflow_router
|
||||
from web.routers.ws_router import router as ws_router
|
||||
from web.routers.faces_router import router as faces_router
|
||||
|
||||
app.include_router(auth_router, prefix="/api/auth", tags=["auth"])
|
||||
app.include_router(admin_router, prefix="/api/admin", tags=["admin"])
|
||||
@@ -191,6 +192,7 @@ def create_app() -> FastAPI:
|
||||
app.include_router(share_router, prefix="/api/share", tags=["share"])
|
||||
app.include_router(workflow_router, prefix="/api/workflow", tags=["workflow"])
|
||||
app.include_router(ws_router, tags=["ws"])
|
||||
app.include_router(faces_router, prefix="/api/faces", tags=["faces"])
|
||||
|
||||
from web.routers.ws_router import websocket_endpoint as _ws_endpoint
|
||||
|
||||
@@ -212,6 +214,11 @@ def create_app() -> FastAPI:
|
||||
|
||||
@app.on_event("startup")
|
||||
async def _startup():
|
||||
try:
|
||||
import face_db
|
||||
face_db.init_db()
|
||||
except Exception as _exc:
|
||||
logger.warning("face_db.init_db() failed (non-fatal): %s", _exc)
|
||||
asyncio.create_task(_status_ticker())
|
||||
asyncio.create_task(_server_state_poller())
|
||||
logger.info("Web background tasks started")
|
||||
@@ -224,12 +231,12 @@ def create_app() -> FastAPI:
|
||||
# ---------------------------------------------------------------------------
|
||||
|
||||
async def _status_ticker() -> None:
|
||||
"""Broadcast status_snapshot to all clients every 5 seconds."""
|
||||
"""Broadcast status_snapshot to all clients every 2 seconds."""
|
||||
from web.deps import get_bot, get_comfy, get_config
|
||||
bus = get_bus()
|
||||
|
||||
while True:
|
||||
await asyncio.sleep(5)
|
||||
await asyncio.sleep(2)
|
||||
try:
|
||||
bot = get_bot()
|
||||
comfy = get_comfy()
|
||||
|
||||
Reference in New Issue
Block a user