Compare commits

...

2 Commits

Author SHA1 Message Date
hj24
dd94f81272 chore: add more logs 2026-01-26 13:59:38 +08:00
hj24
14afad0deb chore: add billing debug log 2026-01-26 13:16:39 +08:00
2 changed files with 6 additions and 0 deletions

View File

@@ -143,6 +143,7 @@ class BillingService:
raise ValueError("Invalid arguments.")
if method == "POST" and response.status_code != httpx.codes.OK:
raise ValueError(f"Unable to send request to {url}. Please try again later or contact support.")
logger.info("billing_service: %s _send_request: response: %s", method, response.json())
return response.json()
@staticmethod
@@ -165,6 +166,7 @@ class BillingService:
def delete_account(cls, account_id: str):
"""Delete account."""
params = {"account_id": account_id}
logger.info("billing_service: delete_account: params: %s", params)
return cls._send_request("DELETE", "/account/", params=params)
@classmethod

View File

@@ -14,10 +14,13 @@ logger = logging.getLogger(__name__)
@shared_task(queue="dataset")
def delete_account_task(account_id):
with session_factory.create_session() as session:
logger.info("delete_account_task: account_id: %s", account_id)
account = session.query(Account).where(Account.id == account_id).first()
try:
if dify_config.BILLING_ENABLED:
logger.info("delete_account_task: before delete_account: %s", account_id)
BillingService.delete_account(account_id)
logger.info("delete_account_task: after delete_account: %s", account_id)
except Exception:
logger.exception("Failed to delete account %s from billing service.", account_id)
raise
@@ -27,3 +30,4 @@ def delete_account_task(account_id):
return
# send success email
send_deletion_success_task.delay(account.email)
logger.info("delete_account_task: delete_account successfully: %s", account_id)