Skip to content

armgit / dify

Public Imported from GitHub
0

Build Agentic workflows, RAG pipelines, with rich AI model and tool support on one collaborative workspace. Deploy on cloud, VPC, or self-hosted, so teams move from prototype to production without rebuilding the stack.

fix(billing_service): change retry condition to handle specific reque… (#12091)

-LAN-017d7538aee8
diff --git a/api/services/billing_service.py b/api/services/billing_service.py
index d9801864883..ed611a8be48 100644
--- a/api/services/billing_service.py
+++ b/api/services/billing_service.py
@@ -2,7 +2,7 @@ import os
from typing import Optional
import httpx
-from tenacity import retry, retry_if_not_exception_type, stop_before_delay, wait_fixed
+from tenacity import retry, retry_if_exception_type, stop_before_delay, wait_fixed
from extensions.ext_database import db
from models.account import TenantAccountJoin, TenantAccountRole
@@ -44,7 +44,7 @@ class BillingService:
@retry(
wait=wait_fixed(2),
stop=stop_before_delay(10),
- retry=retry_if_not_exception_type(httpx.RequestError),
+ retry=retry_if_exception_type(httpx.RequestError),
reraise=True,
)
def _send_request(cls, method, endpoint, json=None, params=None):
diff --git a/api/services/feature_service.py b/api/services/feature_service.py
index 0386c6aceaa..b9261d19d79 100644
--- a/api/services/feature_service.py
+++ b/api/services/feature_service.py
@@ -74,7 +74,7 @@ class FeatureService:
cls._fulfill_params_from_env(features)
- if dify_config.BILLING_ENABLED:
+ if dify_config.BILLING_ENABLED and tenant_id:
cls._fulfill_params_from_billing_api(features, tenant_id)
return features