fix: keep affinity out of scheduler eligibility

This commit is contained in:
RWDai
2026-05-05 11:23:54 +08:00
parent 2cbbd9ca36
commit 14eeff8f75
3 changed files with 3 additions and 21 deletions

View File

@@ -305,7 +305,6 @@ mod tests {
provider_concurrent_limits: &provider_concurrent_limits,
provider_key_rpm_states: &BTreeMap::new(),
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -330,7 +329,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -356,7 +354,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -385,7 +382,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -415,7 +411,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 1_000,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -436,7 +431,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &BTreeMap::new(),
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -460,7 +454,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -496,7 +489,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -524,7 +516,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 99,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -539,7 +530,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -560,7 +550,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &provider_key_rpm_states,
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -574,7 +563,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &BTreeMap::new(),
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: true,
account_quota_exhausted: false,
oauth_invalid: false,
@@ -592,7 +580,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &BTreeMap::new(),
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: true,
oauth_invalid: false,
@@ -610,7 +597,6 @@ mod tests {
provider_concurrent_limits: &BTreeMap::new(),
provider_key_rpm_states: &BTreeMap::new(),
now_unix_secs: 100,
cached_affinity_target: None,
provider_quota_blocks_requests: false,
account_quota_exhausted: false,
oauth_invalid: true,

View File

@@ -26,7 +26,6 @@ pub struct CandidateRuntimeSelectabilityInput<'a> {
pub provider_concurrent_limits: &'a BTreeMap<String, usize>,
pub provider_key_rpm_states: &'a BTreeMap<String, StoredProviderCatalogKey>,
pub now_unix_secs: u64,
pub cached_affinity_target: Option<&'a crate::SchedulerAffinityTarget>,
pub provider_quota_blocks_requests: bool,
pub account_quota_exhausted: bool,
pub oauth_invalid: bool,
@@ -48,7 +47,6 @@ pub fn candidate_runtime_skip_reason_with_state(
provider_concurrent_limits,
provider_key_rpm_states,
now_unix_secs,
cached_affinity_target,
provider_quota_blocks_requests,
account_quota_exhausted,
oauth_invalid,
@@ -104,8 +102,6 @@ pub fn candidate_runtime_skip_reason_with_state(
}
}
let is_cached_user = cached_affinity_target
.is_some_and(|target| crate::matches_affinity_target(candidate, target));
if let Some(provider_key) = provider_key {
if crate::is_provider_key_circuit_open_at(
provider_key,
@@ -123,7 +119,7 @@ pub fn candidate_runtime_skip_reason_with_state(
provider_key,
recent_candidates,
now_unix_secs,
is_cached_user,
false,
rpm_reset_at,
) {
return Some("key_rpm_exhausted");

View File

@@ -853,7 +853,7 @@ mod tests {
fn merges_proxy_trace_info_into_existing_candidate_extra_data() {
let mut existing = sample_candidate("cand-1", 1, 0);
existing.extra_data = Some(json!({
"provider_name": "Codex"
"provider_name": "Provider One"
}));
let metadata = parse_request_candidate_report_context(Some(&json!({
@@ -896,7 +896,7 @@ mod tests {
slot.extra_data
.as_ref()
.and_then(|value| value.get("provider_name")),
Some(&json!("Codex"))
Some(&json!("Provider One"))
);
assert_eq!(
slot.extra_data