mirror of
https://github.com/farion1231/cc-switch.git
synced 2026-07-25 13:45:03 +08:00
fix(proxy): reset health badges when proxy stops
Clear all provider_health records when stopping the proxy server, ensuring health badges reset to "healthy" state. This fixes the inconsistency where circuit breakers (in memory) would reset on stop but health badges (in database) would retain stale state.
This commit is contained in:
@@ -230,6 +230,17 @@ impl Database {
|
||||
Ok(())
|
||||
}
|
||||
|
||||
/// 清空所有Provider健康状态(代理停止时调用)
|
||||
pub async fn clear_all_provider_health(&self) -> Result<(), AppError> {
|
||||
let conn = lock_conn!(self.conn);
|
||||
|
||||
conn.execute("DELETE FROM provider_health", [])
|
||||
.map_err(|e| AppError::Database(e.to_string()))?;
|
||||
|
||||
log::debug!("Cleared all provider health records");
|
||||
Ok(())
|
||||
}
|
||||
|
||||
// ==================== Circuit Breaker Config ====================
|
||||
|
||||
/// 获取熔断器配置
|
||||
|
||||
Reference in New Issue
Block a user