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()