feat: pass session scope into scheduler cache

This commit is contained in:
RWDai
2026-05-05 11:23:54 +08:00
parent 96dd3fa4ca
commit c596d82dec
2 changed files with 14 additions and 5 deletions
@@ -1,6 +1,6 @@
use aether_scheduler_core::{
build_scheduler_affinity_cache_key_for_api_key_id, candidate_affinity_hash, candidate_key,
matches_affinity_target, SchedulerAffinityTarget,
build_scheduler_affinity_cache_key_for_api_key_id_with_client_session, candidate_affinity_hash,
candidate_key, matches_affinity_target, ClientSessionAffinity, SchedulerAffinityTarget,
};
use crate::data::auth::GatewayAuthApiKeySnapshot;
@@ -15,11 +15,17 @@ pub(super) fn build_scheduler_affinity_cache_key(
auth_snapshot: Option<&GatewayAuthApiKeySnapshot>,
api_format: &str,
global_model_name: &str,
client_session_affinity: Option<&ClientSessionAffinity>,
) -> Option<String> {
let api_key_id = auth_snapshot
.map(|snapshot| snapshot.api_key_id.trim())
.filter(|value| !value.is_empty())?;
build_scheduler_affinity_cache_key_for_api_key_id(api_key_id, api_format, global_model_name)
build_scheduler_affinity_cache_key_for_api_key_id_with_client_session(
api_key_id,
api_format,
global_model_name,
client_session_affinity,
)
}
pub(super) fn scheduler_candidate_affinity_hash(