mirror of
https://github.com/diegosouzapw/OmniRoute.git
synced 2026-08-04 06:12:10 +03:00
fix(fallback): merge new provider failure threshold fields in profile
The mergeProviderProfile function was missing the three new fields added to PROVIDER_PROFILES (providerFailureThreshold, providerFailureWindowMs, providerCooldownMs). This caused tests to fail because the profile returned by getRuntimeProviderProfile did not include these fields. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -2,6 +2,7 @@ import {
|
||||
COOLDOWN_MS,
|
||||
BACKOFF_CONFIG,
|
||||
BACKOFF_STEPS_MS,
|
||||
PROVIDER_PROFILES,
|
||||
RateLimitReason,
|
||||
HTTP_STATUS,
|
||||
} from "../config/constants.ts";
|
||||
@@ -27,6 +28,10 @@ type ProviderProfile = {
|
||||
maxBackoffLevel: number;
|
||||
circuitBreakerThreshold: number;
|
||||
circuitBreakerReset: number;
|
||||
// Provider-level circuit breaker fields
|
||||
providerFailureThreshold: number;
|
||||
providerFailureWindowMs: number;
|
||||
providerCooldownMs: number;
|
||||
};
|
||||
type JsonRecord = Record<string, unknown>;
|
||||
type ModelLockoutEntry = {
|
||||
@@ -187,6 +192,10 @@ function buildProviderProfile(
|
||||
maxBackoffLevel: connectionCooldown.maxBackoffSteps,
|
||||
circuitBreakerThreshold: providerBreaker.failureThreshold,
|
||||
circuitBreakerReset: providerBreaker.resetTimeoutMs,
|
||||
// Provider-level circuit breaker fields (not configurable via settings, use PROVIDER_PROFILES defaults)
|
||||
providerFailureThreshold: PROVIDER_PROFILES[category].providerFailureThreshold,
|
||||
providerFailureWindowMs: PROVIDER_PROFILES[category].providerFailureWindowMs,
|
||||
providerCooldownMs: PROVIDER_PROFILES[category].providerCooldownMs,
|
||||
} satisfies ProviderProfile;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user