0.3 增加登录模块
This commit is contained in:
@@ -3,7 +3,7 @@ from fastapi import FastAPI
|
||||
from app.api.routes import router as api_router
|
||||
from app.core.config import get_settings
|
||||
from app.core.logging import setup_logging
|
||||
from app.services.runtime import auto_indexer, scheduler, worker
|
||||
from app.services.runtime import worker
|
||||
|
||||
settings = get_settings()
|
||||
|
||||
@@ -15,22 +15,9 @@ app.include_router(api_router, prefix=settings.api_prefix)
|
||||
|
||||
@app.on_event("startup")
|
||||
async def _startup() -> None:
|
||||
scheduler.start()
|
||||
if getattr(settings, "auto_index_enabled", False):
|
||||
try:
|
||||
await auto_indexer.startup()
|
||||
except Exception: # noqa: BLE001
|
||||
# 启动阶段不阻塞服务:自动入库失败会在后续 tick 中继续重试/记录
|
||||
pass
|
||||
scheduler.add_interval_job(
|
||||
job_id="auto_index_tick",
|
||||
func=auto_indexer.tick,
|
||||
seconds=int(getattr(settings, "auto_index_interval_seconds", 5)),
|
||||
)
|
||||
await worker.start()
|
||||
|
||||
|
||||
@app.on_event("shutdown")
|
||||
async def _shutdown() -> None:
|
||||
scheduler.shutdown()
|
||||
await worker.stop()
|
||||
|
||||
Reference in New Issue
Block a user