mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 16:26:16 +08:00
b06e0fa538
The UI has exposed "请求失败时的重试次数 (0-10, default 3)" since the auto-failover panel was added, but the value was silently dropped — RequestForwarder never received it and the per-provider loop walked the whole list regardless. From the user's perspective the setting was inert. Thread AppProxyConfig.max_retries through create_forwarder into RequestForwarder, derive max_attempts = max_retries + 1 (so max_retries=0 matches the UI copy "0 retries" = single attempt), and break the loop once attempts hit the cap. The check is placed before the circuit breaker allow-permit so an over-cap iteration does not waste a HalfOpen probe slot. When auto-failover is disabled we also force max_retries to 0, mirroring how timeouts already bypass in that mode — "no failover" should mean "one provider, one try", not "limited retries against the same list".