fix: job_queue 모듈 import 방식 수정 — None 참조 해결
모듈 레벨 변수를 직접 import하면 init_queue() 이후에도 None 참조가 유지됨. 모듈 자체를 import하여 접근. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -13,7 +13,7 @@ from config import settings
|
||||
from db.database import init_db
|
||||
from routers import chat
|
||||
from services.backend_registry import backend_registry
|
||||
from services.job_queue import init_queue, job_queue
|
||||
from services import job_queue as jq_module
|
||||
|
||||
logging.basicConfig(
|
||||
level=logging.INFO,
|
||||
@@ -26,7 +26,7 @@ async def lifespan(app: FastAPI):
|
||||
await init_db()
|
||||
backend_registry.init_from_settings(settings)
|
||||
backend_registry.start_health_loop(settings.health_check_interval)
|
||||
init_queue(settings.max_concurrent_jobs)
|
||||
jq_module.init_queue(settings.max_concurrent_jobs)
|
||||
yield
|
||||
backend_registry.stop_health_loop()
|
||||
|
||||
@@ -66,9 +66,8 @@ async def root():
|
||||
|
||||
@app.get("/health")
|
||||
async def health():
|
||||
from services.job_queue import job_queue
|
||||
return {
|
||||
"status": "ok",
|
||||
"backends": backend_registry.health_summary(),
|
||||
"queue": job_queue.stats if job_queue else {},
|
||||
"queue": jq_module.job_queue.stats if jq_module.job_queue else {},
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user