Skip to content

Fix the parsing of execution task params #725

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Jul 16, 2025
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 7 additions & 5 deletions backend/app/task/service/scheduler_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,11 +148,13 @@ async def execute(*, pk: int) -> None:
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:
Expand Down