mirror of
https://github.com/fastapi-practices/fastapi-best-architecture.git
synced 2026-09-21 21:15:13 +00:00
Fix the parsing of execution task params (#725)
* Fix the parsing of execution task params * Enhanced checksums
This commit is contained in:
@@ -148,11 +148,13 @@ class TaskSchedulerService:
|
||||
task_scheduler = await task_scheduler_dao.get(db, pk)
|
||||
if not task_scheduler:
|
||||
raise errors.NotFoundError(msg='任务调度不存在')
|
||||
celery_app.send_task(
|
||||
name=task_scheduler.task,
|
||||
args=json.loads(task_scheduler.args),
|
||||
kwargs=json.loads(task_scheduler.kwargs),
|
||||
)
|
||||
try:
|
||||
args = json.loads(task_scheduler.args) if task_scheduler.args else None
|
||||
kwargs = json.loads(task_scheduler.kwargs) if task_scheduler.kwargs else None
|
||||
except (TypeError, json.JSONDecodeError):
|
||||
raise errors.RequestError(msg='执行失败,任务参数非法')
|
||||
else:
|
||||
celery_app.send_task(name=task_scheduler.task, args=args, kwargs=kwargs)
|
||||
|
||||
@staticmethod
|
||||
async def revoke(*, task_id: str) -> None:
|
||||
|
||||
Reference in New Issue
Block a user