浏览代码

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

Signed-off-by: -LAN- <laipz8200@outlook.com>
Co-authored-by: Garfield Dai <dai.hai@foxmail.com>
tags/0.15.0
-LAN- 10 个月前
父节点
当前提交
017d7538ae
没有帐户链接到提交者的电子邮件
共有 2 个文件被更改,包括 3 次插入3 次删除
  1. 2
    2
      api/services/billing_service.py
  2. 1
    1
      api/services/feature_service.py

+ 2
- 2
api/services/billing_service.py 查看文件

from typing import Optional from typing import Optional


import httpx 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 extensions.ext_database import db
from models.account import TenantAccountJoin, TenantAccountRole from models.account import TenantAccountJoin, TenantAccountRole
@retry( @retry(
wait=wait_fixed(2), wait=wait_fixed(2),
stop=stop_before_delay(10), stop=stop_before_delay(10),
retry=retry_if_not_exception_type(httpx.RequestError),
retry=retry_if_exception_type(httpx.RequestError),
reraise=True, reraise=True,
) )
def _send_request(cls, method, endpoint, json=None, params=None): def _send_request(cls, method, endpoint, json=None, params=None):

+ 1
- 1
api/services/feature_service.py 查看文件



cls._fulfill_params_from_env(features) 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) cls._fulfill_params_from_billing_api(features, tenant_id)


return features return features

正在加载...
取消
保存