23 lines
632 B
Go
23 lines
632 B
Go
package store
|
|
|
|
import (
|
|
"strings"
|
|
"time"
|
|
)
|
|
|
|
type failRetryPolicy struct {
|
|
Retryable bool
|
|
Delay time.Duration
|
|
}
|
|
|
|
func retryPolicyForError(errorCode string) failRetryPolicy {
|
|
switch strings.TrimSpace(errorCode) {
|
|
case "provider_unavailable", "model_unavailable", "provider_error", "dependency_error", "timeout", "storage_error", "stale_worker":
|
|
return failRetryPolicy{Retryable: true, Delay: 30 * time.Second}
|
|
case "bad_response", "transcript_hallucination", "transcript_incomplete", "internal_error", "unknown":
|
|
return failRetryPolicy{Retryable: true, Delay: 2 * time.Minute}
|
|
default:
|
|
return failRetryPolicy{}
|
|
}
|
|
}
|