mirror of
https://github.com/langgenius/dify.git
synced 2026-03-06 15:45:14 +00:00
Compare commits
2 Commits
deploy/mem
...
build/bill
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
dd94f81272 | ||
|
|
14afad0deb |
@@ -143,6 +143,7 @@ class BillingService:
|
|||||||
raise ValueError("Invalid arguments.")
|
raise ValueError("Invalid arguments.")
|
||||||
if method == "POST" and response.status_code != httpx.codes.OK:
|
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.")
|
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()
|
return response.json()
|
||||||
|
|
||||||
@staticmethod
|
@staticmethod
|
||||||
@@ -165,6 +166,7 @@ class BillingService:
|
|||||||
def delete_account(cls, account_id: str):
|
def delete_account(cls, account_id: str):
|
||||||
"""Delete account."""
|
"""Delete account."""
|
||||||
params = {"account_id": account_id}
|
params = {"account_id": account_id}
|
||||||
|
logger.info("billing_service: delete_account: params: %s", params)
|
||||||
return cls._send_request("DELETE", "/account/", params=params)
|
return cls._send_request("DELETE", "/account/", params=params)
|
||||||
|
|
||||||
@classmethod
|
@classmethod
|
||||||
|
|||||||
@@ -14,10 +14,13 @@ logger = logging.getLogger(__name__)
|
|||||||
@shared_task(queue="dataset")
|
@shared_task(queue="dataset")
|
||||||
def delete_account_task(account_id):
|
def delete_account_task(account_id):
|
||||||
with session_factory.create_session() as session:
|
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()
|
account = session.query(Account).where(Account.id == account_id).first()
|
||||||
try:
|
try:
|
||||||
if dify_config.BILLING_ENABLED:
|
if dify_config.BILLING_ENABLED:
|
||||||
|
logger.info("delete_account_task: before delete_account: %s", account_id)
|
||||||
BillingService.delete_account(account_id)
|
BillingService.delete_account(account_id)
|
||||||
|
logger.info("delete_account_task: after delete_account: %s", account_id)
|
||||||
except Exception:
|
except Exception:
|
||||||
logger.exception("Failed to delete account %s from billing service.", account_id)
|
logger.exception("Failed to delete account %s from billing service.", account_id)
|
||||||
raise
|
raise
|
||||||
@@ -27,3 +30,4 @@ def delete_account_task(account_id):
|
|||||||
return
|
return
|
||||||
# send success email
|
# send success email
|
||||||
send_deletion_success_task.delay(account.email)
|
send_deletion_success_task.delay(account.email)
|
||||||
|
logger.info("delete_account_task: delete_account successfully: %s", account_id)
|
||||||
|
|||||||
Reference in New Issue
Block a user