fix(retry): resolve RETRY_BACKOFF_DELAYS initialization order error

- Remove duplicate RETRY_BACKOFF_DELAYS and RETRY_JITTER_FACTOR from Defaults/index.ts
- Export constants from retry-utils.ts as single source of truth
- Add 'as const' for better type inference
- Fixes "Cannot access 'RETRY_BACKOFF_DELAYS' before initialization" error
This commit is contained in:
Claude
2026-01-20 14:17:18 +00:00
parent 37fdce4bf3
commit cf979d6b6d
2 changed files with 7 additions and 15 deletions
+3 -3
View File
@@ -20,15 +20,15 @@ import type { CircuitBreaker } from './circuit-breaker.js'
/**
* Retry configuration with custom progressive backoff
* Fixed delay steps in milliseconds: 1s → 2s → 5s → 10s → 20s
* Defined locally to avoid circular dependency with Defaults
* Exported for external use (e.g., custom retry logic)
*/
const RETRY_BACKOFF_DELAYS = [1000, 2000, 5000, 10000, 20000]
export const RETRY_BACKOFF_DELAYS = [1000, 2000, 5000, 10000, 20000] as const
/**
* Jitter factor for retry delays (0.15 = ±15% randomization)
* Helps prevent thundering herd problem
*/
const RETRY_JITTER_FACTOR = 0.15
export const RETRY_JITTER_FACTOR = 0.15
/**
* Backoff strategies