From f55eb6cd987260ba803f3b52db8d1795798c9182 Mon Sep 17 00:00:00 2001 From: GareArc Date: Wed, 25 Dec 2024 04:08:02 -0500 Subject: [PATCH 1/2] fix: bug --- api/tasks/delete_account_task.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/api/tasks/delete_account_task.py b/api/tasks/delete_account_task.py index fa7a0ce0bff6ab..921f9300253f4a 100644 --- a/api/tasks/delete_account_task.py +++ b/api/tasks/delete_account_task.py @@ -1,7 +1,6 @@ import logging from celery import shared_task # type: ignore - from extensions.ext_database import db from models.account import Account from services.billing_service import BillingService @@ -12,13 +11,13 @@ @shared_task(queue="dataset") def delete_account_task(account_id, reason: str): + account = db.session.query(Account).filter(Account.id == account_id).first() try: BillingService.delete_account(account_id, reason) except Exception as e: logger.exception(f"Failed to delete account {account_id} from billing service.") raise - account = db.session.query(Account).filter(Account.id == account_id).first() if not account: logger.error(f"Account {account_id} not found.") return From 49268d811fb67a350e60e0fb7552891f952eccce Mon Sep 17 00:00:00 2001 From: GareArc Date: Wed, 25 Dec 2024 04:08:22 -0500 Subject: [PATCH 2/2] reformat --- api/tasks/delete_account_task.py | 1 + 1 file changed, 1 insertion(+) diff --git a/api/tasks/delete_account_task.py b/api/tasks/delete_account_task.py index 921f9300253f4a..d005e1178f9eb7 100644 --- a/api/tasks/delete_account_task.py +++ b/api/tasks/delete_account_task.py @@ -1,6 +1,7 @@ import logging from celery import shared_task # type: ignore + from extensions.ext_database import db from models.account import Account from services.billing_service import BillingService