mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-05 00:47:48 +08:00
fix(gateway): expire provider key circuit cooldowns
This commit is contained in:
@@ -241,8 +241,8 @@ async fn gateway_provider_keys_expose_circuit_breaker_and_recover_clears_it() {
|
||||
"open": true,
|
||||
"open_at": "2026-03-26T12:00:00+00:00",
|
||||
"reason": "consecutive_failures_8",
|
||||
"next_probe_at": "2026-03-26T12:01:00+00:00",
|
||||
"next_probe_at_unix_secs": 1774526460u64,
|
||||
"next_probe_at": "2099-03-26T12:01:00+00:00",
|
||||
"next_probe_at_unix_secs": 4078209660u64,
|
||||
"probe_interval_minutes": 1,
|
||||
"max_probe_interval_minutes": 32,
|
||||
"half_open_until": null,
|
||||
|
||||
@@ -346,7 +346,7 @@ async fn gateway_handles_admin_key_health_locally_with_trusted_admin_principal()
|
||||
Some(json!({"openai:chat": {
|
||||
"open": true,
|
||||
"open_at": "2026-03-26T12:01:00+00:00",
|
||||
"next_probe_at": "2026-03-26T12:05:00+00:00",
|
||||
"next_probe_at": "2099-03-26T12:05:00+00:00",
|
||||
"half_open_until": null,
|
||||
"half_open_successes": 1,
|
||||
"half_open_failures": 0
|
||||
@@ -399,7 +399,7 @@ async fn gateway_handles_admin_key_health_locally_with_trusted_admin_principal()
|
||||
payload["circuit_breaker_open_at"],
|
||||
"2026-03-26T12:01:00+00:00"
|
||||
);
|
||||
assert_eq!(payload["next_probe_at"], "2026-03-26T12:05:00+00:00");
|
||||
assert_eq!(payload["next_probe_at"], "2099-03-26T12:05:00+00:00");
|
||||
assert_eq!(payload["half_open_successes"], 1);
|
||||
assert_eq!(payload["half_open_failures"], 0);
|
||||
assert_eq!(*upstream_hits.lock().expect("mutex should lock"), 0);
|
||||
@@ -442,7 +442,7 @@ async fn gateway_recovers_admin_key_health_locally_with_trusted_admin_principal(
|
||||
Some(json!({"openai:chat": {
|
||||
"open": true,
|
||||
"open_at": "2026-03-26T12:01:00+00:00",
|
||||
"next_probe_at": "2026-03-26T12:05:00+00:00",
|
||||
"next_probe_at": "2099-03-26T12:05:00+00:00",
|
||||
"half_open_until": null,
|
||||
"half_open_successes": 0,
|
||||
"half_open_failures": 1
|
||||
|
||||
@@ -789,7 +789,7 @@ async fn gateway_handles_admin_global_model_routing_locally_with_trusted_admin_p
|
||||
"openai:chat": {"health_score": 0.66}
|
||||
}));
|
||||
primary_key.circuit_breaker_by_format = Some(json!({
|
||||
"openai:chat": {"open": true, "next_probe_at": "2026-03-27T15:00:00Z"}
|
||||
"openai:chat": {"open": true, "next_probe_at": "2099-03-27T15:00:00Z"}
|
||||
}));
|
||||
|
||||
let mut mapped_key = sample_key(
|
||||
@@ -907,7 +907,7 @@ async fn gateway_handles_admin_global_model_routing_locally_with_trusted_admin_p
|
||||
openai_keys[0]["circuit_breaker_formats"],
|
||||
json!(["openai:chat"])
|
||||
);
|
||||
assert_eq!(openai_keys[0]["next_probe_at"], "2026-03-27T15:00:00Z");
|
||||
assert_eq!(openai_keys[0]["next_probe_at"], "2099-03-27T15:00:00Z");
|
||||
|
||||
let alt_endpoints = providers[1]["endpoints"]
|
||||
.as_array()
|
||||
|
||||
@@ -2040,7 +2040,8 @@ async fn gateway_handles_admin_monitoring_resilience_circuit_history_locally_wit
|
||||
"openai:chat": {
|
||||
"open": true,
|
||||
"open_at": "2026-03-30T12:00:00+00:00",
|
||||
"next_probe_at": "2026-03-30T12:05:00+00:00",
|
||||
"next_probe_at": "2099-03-30T12:05:00+00:00",
|
||||
"recovery_seconds": 300,
|
||||
"reason": "错误率过高"
|
||||
}
|
||||
})),
|
||||
|
||||
Reference in New Issue
Block a user