fix(douyu): 修复斗鱼链路 P0/P1 隐患并增强 P2 运维队列可观测性
This commit is contained in:
@@ -335,6 +335,7 @@ class GoldMixin:
|
||||
except Exception as exc: # noqa: BLE001 余额核对失败仍继续查供应商
|
||||
gold_error = str(exc)
|
||||
|
||||
client = None
|
||||
try:
|
||||
client = FishFinRechargeClient(FishFinRechargeConfig.from_env())
|
||||
payload = client.query_order(order_no)
|
||||
@@ -349,6 +350,11 @@ class GoldMixin:
|
||||
)
|
||||
except Exception as exc: # noqa: BLE001 供应商查询异常由持久调度继续重试
|
||||
supplier_error = str(exc)
|
||||
finally:
|
||||
if client is not None:
|
||||
close = getattr(client, "close", None)
|
||||
if callable(close):
|
||||
close()
|
||||
|
||||
# 查询期间供应商回调可能已经把任务收口。重新锁行后再决定是否写入,
|
||||
# 避免长时间 HTTP 调用结束后用旧状态覆盖回调结果。
|
||||
@@ -667,17 +673,22 @@ class GoldMixin:
|
||||
)
|
||||
|
||||
client = FishFinRechargeClient(FishFinRechargeConfig.from_env(), trace=trace)
|
||||
order_payload = client.create_order(
|
||||
buy_num=amount,
|
||||
pay_amount=pay_amount,
|
||||
out_order_id=order_no,
|
||||
product_id=product_id,
|
||||
recharge_arg=[
|
||||
{"templateName": template_name, "templateVal": recharge_account}
|
||||
],
|
||||
order_type=0,
|
||||
notify_url=client.config.notify_url,
|
||||
)
|
||||
try:
|
||||
order_payload = client.create_order(
|
||||
buy_num=amount,
|
||||
pay_amount=pay_amount,
|
||||
out_order_id=order_no,
|
||||
product_id=product_id,
|
||||
recharge_arg=[
|
||||
{"templateName": template_name, "templateVal": recharge_account}
|
||||
],
|
||||
order_type=0,
|
||||
notify_url=client.config.notify_url,
|
||||
)
|
||||
finally:
|
||||
close = getattr(client, "close", None)
|
||||
if callable(close):
|
||||
close()
|
||||
code = self._to_int(self._supplier_value(order_payload, "code"))
|
||||
status = self._supplier_order_status(order_payload)
|
||||
result = {
|
||||
|
||||
Reference in New Issue
Block a user