fix(celery): 修复AsyncResult缺少celery_app导致DisabledBackend错误
- project.py中AsyncResult调用添加app=celery_app参数 - 解决自动分类状态查询时500错误
This commit is contained in:
@@ -115,7 +115,8 @@ def project_auto_classify(
|
||||
if background:
|
||||
# Check if already running
|
||||
if project.celery_task_id:
|
||||
existing = AsyncResult(project.celery_task_id)
|
||||
from app.tasks.worker import celery_app
|
||||
existing = AsyncResult(project.celery_task_id, app=celery_app)
|
||||
if existing.state in ("PENDING", "PROGRESS", "STARTED"):
|
||||
return ResponseModel(data={"task_id": project.celery_task_id, "status": existing.state})
|
||||
|
||||
@@ -163,7 +164,8 @@ def project_auto_classify_status(
|
||||
progress = json.loads(project.scan_progress) if project.scan_progress else None
|
||||
return ResponseModel(data={"status": project.status, "progress": progress})
|
||||
|
||||
result = AsyncResult(task_id)
|
||||
from app.tasks.worker import celery_app
|
||||
result = AsyncResult(task_id, app=celery_app)
|
||||
progress = None
|
||||
if result.state == "PROGRESS" and result.info:
|
||||
progress = result.info
|
||||
|
||||
Reference in New Issue
Block a user