From 6d6d16129a0d37fa4c28084effbc3b864cdc242a Mon Sep 17 00:00:00 2001 From: GareArc Date: Sat, 21 Dec 2024 14:20:40 -0500 Subject: [PATCH] fix: params of celery function should be serializable --- api/services/account_service.py | 2 +- api/tasks/delete_account_task.py | 3 ++- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/api/services/account_service.py b/api/services/account_service.py index f07e88599f15ca..69b88dc4eb5073 100644 --- a/api/services/account_service.py +++ b/api/services/account_service.py @@ -275,7 +275,7 @@ def verify_account_deletion_code(token: str, code: str) -> bool: @staticmethod def delete_account(account: Account, reason="") -> None: """Delete account. This method only adds a task to the queue for deletion.""" - delete_account_task.delay(account, reason) + delete_account_task.delay(account.id, reason) @staticmethod def link_account_integrate(provider: str, open_id: str, account: Account) -> None: diff --git a/api/tasks/delete_account_task.py b/api/tasks/delete_account_task.py index c72d88fd404d2d..ffea9d971e6491 100644 --- a/api/tasks/delete_account_task.py +++ b/api/tasks/delete_account_task.py @@ -15,7 +15,8 @@ @shared_task(queue="dataset") -def delete_account_task(account: Account, reason: str): +def delete_account_task(account_id, reason: str): + account = db.session.query(Account).filter(Account.id == account_id).first() logger.info(click.style("Start delete account task.", fg="green")) start_at = time.perf_counter()