|
|
@@ -719,12 +719,12 @@ async def send_approval_request(
|
|
|
},
|
|
|
)
|
|
|
|
|
|
- # ═══ 等待飞书回复(优先读本地 chat_history,回退到 HTTP 轮询)═══
|
|
|
+ # ═══ 等待飞书回复(本地 chat_history + HTTP 轮询双通道)═══
|
|
|
timeout_at = datetime.now() + timedelta(minutes=timeout_minutes)
|
|
|
use_local_poll = bool(_operator_contact_name)
|
|
|
logger.info(
|
|
|
"等待审批回复:mode=%s,超时 %d 分钟",
|
|
|
- "local_chat_history" if use_local_poll else "http_poll",
|
|
|
+ "local+http" if use_local_poll else "http_poll",
|
|
|
timeout_minutes,
|
|
|
)
|
|
|
|
|
|
@@ -781,9 +781,11 @@ async def send_approval_request(
|
|
|
)
|
|
|
except Exception as e:
|
|
|
logger.debug("读取 chat_history 失败(将重试): %s", e)
|
|
|
- continue # 跳过 HTTP 轮询
|
|
|
+ # 每 30 秒同时尝试 HTTP 轮询(兜底:WebSocket 断连时仍可检测)
|
|
|
+ if poll_count % 30 != 0:
|
|
|
+ continue
|
|
|
|
|
|
- # ─── 回退:HTTP 轮询(原有逻辑,仅在联系人未配置时使用)───
|
|
|
+ # ─── HTTP 轮询(主通道 / 每 30 秒兜底)───
|
|
|
try:
|
|
|
for chat_id in poll_chat_ids:
|
|
|
result = _feishu.get_message_list(
|