mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-27 16:26:16 +08:00
fix(failover): patch P1-P3 reliability gaps surfaced by team review
- Forwarder buffers non-streaming bodies and primes streaming first chunk before signaling success, so body timeouts and SSE first-chunk failures route through the circuit breaker instead of being recorded as success on response-header arrival - Atomic enable-failover: switch to P1 before persisting the flag, and roll back auto-added queue entries when the switch is rejected (e.g. official providers) - Hot-reload circuit breaker config on per-app proxy config change instead of waiting for a proxy restart - FailoverToggle / FailoverQueueManager / AutoFailoverConfigPanel require proxy takeover for the active app; the backend command also rejects enabling when takeover is off - ProviderHealthBadge consumes the backend is_healthy flag instead of hardcoding the 5-failure threshold Cleanup: - impl From<&AppProxyConfig> for CircuitBreakerConfig and use it from the command layer - Collapse three identical TabsContent blocks into a single map
This commit is contained in:
@@ -1993,6 +1993,23 @@ impl ProxyService {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 热更新指定应用的熔断器配置
|
||||
pub async fn update_circuit_breaker_config_for_app(
|
||||
&self,
|
||||
app_type: &str,
|
||||
config: crate::proxy::CircuitBreakerConfig,
|
||||
) -> Result<(), String> {
|
||||
if let Some(server) = self.server.read().await.as_ref() {
|
||||
server
|
||||
.update_circuit_breaker_config_for_app(app_type, config)
|
||||
.await;
|
||||
log::info!("已热更新 {app_type} 运行中的熔断器配置");
|
||||
} else {
|
||||
log::debug!("{app_type} 熔断器配置将在下次代理启动时生效");
|
||||
}
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 重置指定 Provider 的熔断器
|
||||
///
|
||||
/// 如果代理服务器正在运行,立即重置内存中的熔断器状态
|
||||
|
||||
Reference in New Issue
Block a user