fix: address M2.5 verifier findings before merge
AIMD ceiling now respects per-source max_concurrency and the pacer is assembled explicitly in the client; MIN_CALLS parses as strict int; acceptance doc corrects source-5 attempt count to 549; design and migration notes aligned with implemented 429/stall/suppression semantics and AIMD constants documented.
This commit is contained in:
@@ -25,6 +25,7 @@ from polygateway.middleware.telemetry import TelemetryEmitter, TelemetryMW
|
||||
from polygateway.pricing import PricingTable
|
||||
from polygateway.providers import get_provider
|
||||
from polygateway.sources import (
|
||||
AdaptivePacer,
|
||||
HealthAwareSelector,
|
||||
LeastInflightSelector,
|
||||
RoundRobinSelector,
|
||||
@@ -97,6 +98,10 @@ class GatewayClient:
|
||||
backpressure=backpressure,
|
||||
quota_full=quota_full,
|
||||
cooldown_memo=SourceCooldownMemo(now=now),
|
||||
# AIMD ceiling 尊重源级静态并发上限(独立核验 I1: 不得静默钳制大于 64 的配置)
|
||||
pacer=AdaptivePacer(
|
||||
ceiling=float(max([64, *(s.max_concurrency for s in sources if s.max_concurrency)]))
|
||||
),
|
||||
emitter=emitter,
|
||||
now=now,
|
||||
sleep=sleep,
|
||||
@@ -128,6 +133,7 @@ class GatewayClient:
|
||||
)
|
||||
)
|
||||
self._structured_available = structured_strategy is not None
|
||||
self._terminal = terminal # 内部引用: 装配自省/测试用
|
||||
self._handler = compose(middlewares, terminal)
|
||||
self._transport = transport
|
||||
self._telemetry = telemetry
|
||||
|
||||
@@ -231,7 +231,8 @@ def _load_breaker(
|
||||
# 派生规则: 探针租约须撑过一次最慢调用,且不短于冷却期(第三项保证守卫恒成立)
|
||||
probe_ttl_s = max(2 * slowest, cooldown_s, probe_floor)
|
||||
# M2.5 失败率通道参数(可选键,库缺省——韧性参数缺省先例同 backpressure)
|
||||
min_calls = int(_opt_float(env, f"{scope}__BREAKER__MIN_CALLS", 10))
|
||||
raw_min = env.get(f"{scope}__BREAKER__MIN_CALLS")
|
||||
min_calls = int(_cast(raw_min, "int", f"{scope}__BREAKER__MIN_CALLS")) if raw_min else 10
|
||||
fail_rate = _opt_float(env, f"{scope}__BREAKER__FAIL_RATE", 0.6)
|
||||
window_s = _opt_float(env, f"{scope}__BREAKER__WINDOW_S", 60.0)
|
||||
max_cooldown_s = _opt_float(env, f"{scope}__BREAKER__MAX_COOLDOWN_S", max(300.0, cooldown_s))
|
||||
|
||||
Reference in New Issue
Block a user