mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-08-02 18:41:35 +08:00
fix(proxy): resolve HalfOpen counter underflow and config field inconsistencies
- Fix HalfOpen counter underflow: increment half_open_requests when transitioning from Open to HalfOpen to prevent underflow in record_success/record_failure - Fix Gemini config field names: unify to GEMINI_API_KEY and GOOGLE_GEMINI_BASE_URL (removed GOOGLE_API_KEY and GEMINI_API_BASE) - Fix Codex proxy takeover: write base_url to config.toml instead of OPENAI_BASE_URL in auth.json (Codex CLI reads from config.toml)
This commit is contained in:
@@ -115,6 +115,8 @@ impl CircuitBreaker {
|
||||
"Circuit breaker transitioning from Open to HalfOpen (timeout reached)"
|
||||
);
|
||||
self.transition_to_half_open().await;
|
||||
// 增加计数,确保 record_success/record_failure 减计数时不会下溢
|
||||
self.half_open_requests.fetch_add(1, Ordering::SeqCst);
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user