mirror of
https://github.com/tiennm99/ccs.git
synced 2026-09-04 10:16:34 +00:00
fix(cliproxy): tighten session affinity status handling
This commit is contained in:
@@ -99,6 +99,8 @@ const MIN_STALE_HIGH_ONLY_GEMINI_MINOR_VERSIONS = 3;
|
||||
const MIN_STALE_GUESSED_GEMINI_AVERAGE_VARIANTS_PER_MINOR = 2;
|
||||
const LEGACY_GEMINI_STALE_ALIAS_MIGRATION_VERSION = 16;
|
||||
const MAX_LEGACY_MANUAL_GEMINI_MINOR_VERSION = 2;
|
||||
const GO_DURATION_SEGMENT = String.raw`(?:\d+(?:\.\d+)?(?:ns|us|µs|μs|ms|s|m|h))`;
|
||||
const GO_DURATION_PATTERN = new RegExp(`^${GO_DURATION_SEGMENT}+$`);
|
||||
|
||||
/**
|
||||
* Get provider configuration
|
||||
@@ -139,7 +141,7 @@ function getSessionAffinityEnabled(): boolean {
|
||||
|
||||
function getSessionAffinityTtl(): string {
|
||||
const ttl = loadOrCreateUnifiedConfig().cliproxy?.routing?.session_affinity_ttl?.trim();
|
||||
return ttl || '1h';
|
||||
return ttl && GO_DURATION_PATTERN.test(ttl) ? ttl : '1h';
|
||||
}
|
||||
|
||||
function sanitizeYamlScalar(rawValue: string): string {
|
||||
|
||||
Reference in New Issue
Block a user