fix: fix delete_account_task not check billing enabled (#29577)

This commit is contained in:
wangxiaolei
2025-12-15 10:12:35 +08:00
committed by GitHub
parent 59137f1d05
commit 470650d1d7
2 changed files with 115 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ import logging
from celery import shared_task
from configs import dify_config
from extensions.ext_database import db
from models import Account
from services.billing_service import BillingService
@@ -14,7 +15,8 @@ logger = logging.getLogger(__name__)
def delete_account_task(account_id):
account = db.session.query(Account).where(Account.id == account_id).first()
try:
BillingService.delete_account(account_id)
if dify_config.BILLING_ENABLED:
BillingService.delete_account(account_id)
except Exception:
logger.exception("Failed to delete account %s from billing service.", account_id)
raise