From 7f9970fa066b014d1f2bfef5526281edb21fbf82 Mon Sep 17 00:00:00 2001 From: Claude Date: Tue, 20 Jan 2026 12:31:34 +0000 Subject: [PATCH] fix(retry): resolve circular dependency with Defaults module Define RETRY_BACKOFF_DELAYS and RETRY_JITTER_FACTOR locally in retry-utils.ts to avoid circular dependency that caused "Cannot access 'RETRY_BACKOFF_DELAYS' before initialization" error. --- src/Utils/retry-utils.ts | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/src/Utils/retry-utils.ts b/src/Utils/retry-utils.ts index 72677105..1936e767 100644 --- a/src/Utils/retry-utils.ts +++ b/src/Utils/retry-utils.ts @@ -16,7 +16,19 @@ import { EventEmitter } from 'events' import { metrics } from './prometheus-metrics.js' import type { CircuitBreaker } from './circuit-breaker.js' -import { RETRY_BACKOFF_DELAYS, RETRY_JITTER_FACTOR } from '../Defaults/index.js' + +/** + * Retry configuration with exponential backoff + * Delays in milliseconds: 1s, 2s, 5s, 10s, 20s + * Defined locally to avoid circular dependency with Defaults + */ +const RETRY_BACKOFF_DELAYS = [1000, 2000, 5000, 10000, 20000] + +/** + * Jitter factor for retry delays (0.15 = ±15% randomization) + * Helps prevent thundering herd problem + */ +const RETRY_JITTER_FACTOR = 0.15 /** * Backoff strategies