mirror of
https://github.com/fawney19/Aether.git
synced 2026-09-09 04:30:20 +08:00
Keep key circuit breaker out of pool scoring
This commit is contained in:
@@ -6,7 +6,6 @@ use aether_data_contracts::repository::provider_catalog::StoredProviderCatalogKe
|
||||
use aether_pool_core::{
|
||||
score_pool_member_with_rules, PoolMemberScoreInput, PoolMemberScoreRules, POOL_SCORE_VERSION,
|
||||
};
|
||||
use aether_scheduler_core::any_provider_key_circuit_open_at;
|
||||
use serde_json::Value;
|
||||
|
||||
use crate::handlers::shared::{provider_key_health_summary, provider_key_status_snapshot_payload};
|
||||
@@ -100,7 +99,6 @@ fn provider_key_score_input(
|
||||
.and_then(|snapshot| snapshot.get("account"))
|
||||
.and_then(Value::as_object);
|
||||
let (health_score, _, _, _, _) = provider_key_health_summary(key);
|
||||
let active_circuit_open = any_provider_key_circuit_open_at(key, now_unix_secs);
|
||||
let health_score = key
|
||||
.health_by_format
|
||||
.as_ref()
|
||||
@@ -127,7 +125,6 @@ fn provider_key_score_input(
|
||||
.and_then(Value::as_bool)
|
||||
.unwrap_or(false),
|
||||
oauth_invalid_reason: key.oauth_invalid_reason.clone(),
|
||||
circuit_open: active_circuit_open,
|
||||
success_count: key.success_count.unwrap_or(0).into(),
|
||||
error_count: key.error_count.unwrap_or(0).into(),
|
||||
total_response_time_ms: key.total_response_time_ms.unwrap_or(0).into(),
|
||||
@@ -213,7 +210,7 @@ mod tests {
|
||||
}
|
||||
|
||||
#[test]
|
||||
fn future_circuit_probe_deadline_keeps_pool_score_in_cooldown() {
|
||||
fn future_key_circuit_probe_deadline_does_not_drive_pool_score_cooldown() {
|
||||
let now_unix_secs = 1_000;
|
||||
let key = sample_key_with_circuit_next_probe(1_100);
|
||||
|
||||
@@ -225,6 +222,6 @@ mod tests {
|
||||
PoolMemberScoreRules::default(),
|
||||
);
|
||||
|
||||
assert_eq!(score.hard_state, PoolMemberHardState::Cooldown);
|
||||
assert_eq!(score.hard_state, PoolMemberHardState::Available);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -138,7 +138,6 @@ pub struct PoolMemberScoreInput {
|
||||
pub quota_exhausted: bool,
|
||||
pub account_blocked: bool,
|
||||
pub oauth_invalid_reason: Option<String>,
|
||||
pub circuit_open: bool,
|
||||
pub success_count: u64,
|
||||
pub error_count: u64,
|
||||
pub total_response_time_ms: u64,
|
||||
@@ -260,9 +259,6 @@ fn derive_hard_state(
|
||||
if input.quota_exhausted {
|
||||
return PoolMemberHardState::QuotaExhausted;
|
||||
}
|
||||
if input.circuit_open {
|
||||
return PoolMemberHardState::Cooldown;
|
||||
}
|
||||
if input.probe_status == PoolMemberProbeStatus::Failed
|
||||
&& rules.probe_failure_cooldown_threshold > 0
|
||||
&& input.probe_failure_count >= rules.probe_failure_cooldown_threshold
|
||||
@@ -370,7 +366,6 @@ mod tests {
|
||||
quota_exhausted: false,
|
||||
account_blocked: false,
|
||||
oauth_invalid_reason: None,
|
||||
circuit_open: false,
|
||||
success_count: 10,
|
||||
error_count: 0,
|
||||
total_response_time_ms: 2_000,
|
||||
|
||||
Reference in New Issue
Block a user