mirror of
https://github.com/fawney19/Aether.git
synced 2026-10-09 10:57:03 +08:00
Improve gateway transport and usage runtime
This commit is contained in:
@@ -36,6 +36,7 @@ async fn select_candidate(
|
||||
global_model_name: &str,
|
||||
require_streaming: bool,
|
||||
auth_snapshot: Option<&GatewayAuthApiKeySnapshot>,
|
||||
client_session_affinity: Option<&ClientSessionAffinity>,
|
||||
now_unix_secs: u64,
|
||||
) -> Result<Option<SchedulerMinimalCandidateSelectionCandidate>, GatewayError> {
|
||||
select_candidate_impl(
|
||||
@@ -46,7 +47,7 @@ async fn select_candidate(
|
||||
require_streaming,
|
||||
None,
|
||||
auth_snapshot,
|
||||
None,
|
||||
client_session_affinity,
|
||||
now_unix_secs,
|
||||
false,
|
||||
)
|
||||
@@ -207,9 +208,14 @@ async fn reuses_cached_scheduler_affinity_candidate_before_sorted_fallback() {
|
||||
);
|
||||
|
||||
let auth_snapshot = sample_auth_snapshot("affinity-key-1");
|
||||
let cache_key =
|
||||
build_scheduler_affinity_cache_key(Some(&auth_snapshot), "openai:chat", "gpt-4.1", None)
|
||||
.expect("cache key should build");
|
||||
let client_session_affinity = ClientSessionAffinity::from_session_key("session-1");
|
||||
let cache_key = build_scheduler_affinity_cache_key(
|
||||
Some(&auth_snapshot),
|
||||
"openai:chat",
|
||||
"gpt-4.1",
|
||||
Some(&client_session_affinity),
|
||||
)
|
||||
.expect("cache key should build");
|
||||
state.remember_scheduler_affinity_target(
|
||||
&cache_key,
|
||||
SchedulerAffinityTarget {
|
||||
@@ -228,6 +234,7 @@ async fn reuses_cached_scheduler_affinity_candidate_before_sorted_fallback() {
|
||||
"gpt-4.1",
|
||||
false,
|
||||
Some(&auth_snapshot),
|
||||
Some(&client_session_affinity),
|
||||
100,
|
||||
)
|
||||
.await
|
||||
@@ -312,9 +319,14 @@ async fn cached_affinity_candidate_cannot_use_reserved_provider_key_rpm_capacity
|
||||
);
|
||||
|
||||
let auth_snapshot = sample_auth_snapshot("api-key-cached-user");
|
||||
let cache_key =
|
||||
build_scheduler_affinity_cache_key(Some(&auth_snapshot), "openai:chat", "gpt-4.1", None)
|
||||
.expect("cache key should build");
|
||||
let client_session_affinity = ClientSessionAffinity::from_session_key("session-1");
|
||||
let cache_key = build_scheduler_affinity_cache_key(
|
||||
Some(&auth_snapshot),
|
||||
"openai:chat",
|
||||
"gpt-4.1",
|
||||
Some(&client_session_affinity),
|
||||
)
|
||||
.expect("cache key should build");
|
||||
state.remember_scheduler_affinity_target(
|
||||
&cache_key,
|
||||
SchedulerAffinityTarget {
|
||||
@@ -333,6 +345,7 @@ async fn cached_affinity_candidate_cannot_use_reserved_provider_key_rpm_capacity
|
||||
"gpt-4.1",
|
||||
false,
|
||||
Some(&auth_snapshot),
|
||||
Some(&client_session_affinity),
|
||||
100,
|
||||
)
|
||||
.await
|
||||
|
||||
Reference in New Issue
Block a user