|
@@ -1030,6 +1030,27 @@ CASES = [
|
|
|
]
|
|
]
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
+# ── 长耗时 AI 路径单列超时(避免「正常但慢」被误判成 CONN_ERR)───────────────
|
|
|
|
|
+# 这些接口即使空体冒烟也会同步触发 LLM 调用,历史实测耗时在 5~50s 区间抖动,
|
|
|
|
|
+# 网关侧另有 proxy_read_timeout 60s 的一道 504。若沿用统一的 --timeout(8~10s),
|
|
|
|
|
+# 同一接口会在 fix/reg 之间来回假翻转(06:54 轮实测 9.52s 通过、10.55s 被斩,
|
|
|
|
|
+# 恰好骑在 10s 阈值两侧)。故此处按前缀单列更宽的超时,让慢但成功如实记 BIZ_OK,
|
|
|
|
|
+# 让真正超过网关 60s 的失败如实记 SERVER_ERR/504,而不是混成 CONN_ERR。
|
|
|
|
|
+SLOW_PATH_PREFIXES = (
|
|
|
|
|
+ '/api/user/portrait/generate',
|
|
|
|
|
+ '/api/user/portrait/regenerate',
|
|
|
|
|
+)
|
|
|
|
|
+SLOW_PATH_TIMEOUT = int(os.getenv('CFC_SLOW_TIMEOUT', '90'))
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
|
|
+def _timeout_for(path, default):
|
|
|
|
|
+ """长耗时 AI 路径放行到 SLOW_PATH_TIMEOUT,其余接口沿用 --timeout。"""
|
|
|
|
|
+ for _pfx in SLOW_PATH_PREFIXES:
|
|
|
|
|
+ if path.startswith(_pfx):
|
|
|
|
|
+ return max(default, SLOW_PATH_TIMEOUT)
|
|
|
|
|
+ return default
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
def _call(base, method, path, token=None, timeout=10, host=None, body=b'{}'):
|
|
def _call(base, method, path, token=None, timeout=10, host=None, body=b'{}'):
|
|
|
url = base.rstrip('/') + path
|
|
url = base.rstrip('/') + path
|
|
|
headers = {'Content-Type': 'application/json'}
|
|
headers = {'Content-Type': 'application/json'}
|
|
@@ -1246,7 +1267,8 @@ def main():
|
|
|
_m = body_map.get((method, real)) or body_map.get((method, path))
|
|
_m = body_map.get((method, real)) or body_map.get((method, path))
|
|
|
if _m is not None:
|
|
if _m is not None:
|
|
|
body = _m
|
|
body = _m
|
|
|
- r = _call(args.base, method, real, token=token, timeout=args.timeout, host=args.host, body=body)
|
|
|
|
|
|
|
+ r = _call(args.base, method, real, token=token, timeout=_timeout_for(real, args.timeout),
|
|
|
|
|
+ host=args.host, body=body)
|
|
|
http_code, biz, cat = _classify(r)
|
|
http_code, biz, cat = _classify(r)
|
|
|
stats[cat] = stats.get(cat, 0) + 1
|
|
stats[cat] = stats.get(cat, 0) + 1
|
|
|
pages.add(page)
|
|
pages.add(page)
|
|
@@ -1264,7 +1286,7 @@ def main():
|
|
|
return ''
|
|
return ''
|
|
|
|
|
|
|
|
def _run(page, fn, method, path, body, tok):
|
|
def _run(page, fn, method, path, body, tok):
|
|
|
- rr = _call(args.base, method, path, token=tok, timeout=args.timeout,
|
|
|
|
|
|
|
+ rr = _call(args.base, method, path, token=tok, timeout=_timeout_for(path, args.timeout),
|
|
|
host=args.host, body=body)
|
|
host=args.host, body=body)
|
|
|
hc, bz, ct = _classify(rr)
|
|
hc, bz, ct = _classify(rr)
|
|
|
stats[ct] = stats.get(ct, 0) + 1
|
|
stats[ct] = stats.get(ct, 0) + 1
|