Update the celery configuration and tasks (#458)

* Update the celery configuration and tasks

* fix message notifications
This commit is contained in:
Wu Clan
2024-11-15 14:29:02 +08:00
committed by GitHub
parent 576ed77d36
commit fc5a0f9dfa
13 changed files with 408 additions and 82 deletions
+4 -4
View File
@@ -24,18 +24,18 @@ class TaskService:
@staticmethod
def get_status(uid: str):
try:
result = AsyncResult(id=uid, app=celery_app)
task_result = AsyncResult(id=uid, app=celery_app)
except NotRegistered:
raise NotFoundError(msg='任务不存在')
return result.status
return task_result.status
@staticmethod
def get_result(uid: str):
try:
result = AsyncResult(id=uid, app=celery_app)
task_result = AsyncResult(id=uid, app=celery_app)
except NotRegistered:
raise NotFoundError(msg='任务不存在')
return result
return task_result.result
@staticmethod
def run(*, name: str, args: list | None = None, kwargs: dict | None = None):