fix: treat local rate limit queueing separately
This commit is contained in:
@@ -93,6 +93,25 @@ func TestFailoverPolicyAllowsModelOverride(t *testing.T) {
|
||||
}
|
||||
}
|
||||
|
||||
func TestLocalRateLimitWaitsInQueueWithoutRetryOrFailover(t *testing.T) {
|
||||
err := &localRateLimitError{
|
||||
clientErr: &clients.ClientError{Code: "rate_limit", Message: "local capacity exceeded", Retryable: true},
|
||||
cause: &store.RateLimitExceededError{Metric: "concurrent", Retryable: true},
|
||||
}
|
||||
retryDecision := retryDecisionForCandidate(store.RuntimeModelCandidate{}, err)
|
||||
if retryDecision.Retry || retryDecision.Reason != "local_rate_limit_wait_queue" {
|
||||
t.Fatalf("local rate limit should not be same-client retry, got %+v", retryDecision)
|
||||
}
|
||||
|
||||
failoverDecision := failoverDecisionForCandidate(store.RunnerPolicy{
|
||||
Status: "active",
|
||||
FailoverPolicy: map[string]any{"enabled": true, "allowCategories": []any{"rate_limit"}},
|
||||
}, store.RuntimeModelCandidate{}, err)
|
||||
if failoverDecision.Retry || failoverDecision.Action != "queue" || failoverDecision.Reason != "local_rate_limit_wait_queue" {
|
||||
t.Fatalf("local rate limit should wait in queue without failover, got %+v", failoverDecision)
|
||||
}
|
||||
}
|
||||
|
||||
func TestProviderAuthErrorsFailOverInsteadOfHardStop(t *testing.T) {
|
||||
runnerPolicy := store.RunnerPolicy{
|
||||
Status: "active",
|
||||
|
||||
Reference in New Issue
Block a user