Skip to content

Commit

Permalink
fix(billing_service): change retry condition to handle specific reque… (
Browse files Browse the repository at this point in the history
#12091)

Signed-off-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: Garfield Dai <dai.hai@foxmail.com>
  • Loading branch information
laipz8200 and GarfieldDai authored Dec 25, 2024
1 parent a1c78ad commit 017d753
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 3 deletions.
4 changes: 2 additions & 2 deletions api/services/billing_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
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
Expand Down Expand Up @@ -44,7 +44,7 @@ def get_invoices(cls, prefilled_email: str = "", tenant_id: str = ""):
@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):
Expand Down
2 changes: 1 addition & 1 deletion api/services/feature_service.py
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ def get_features(cls, tenant_id: str) -> FeatureModel:

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
Expand Down

0 comments on commit 017d753

Please sign in to comment.