From 9793b4027559aacb1d633690e60f422faeb68ee8 Mon Sep 17 00:00:00 2001 From: Levente Kiss Date: Fri, 31 Oct 2025 18:39:15 +1300 Subject: [PATCH] fix: add stopAllRetries method to RetryManager for proper cleanup --- packages/sdk/src/reliable_channel/retry_manager.ts | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/packages/sdk/src/reliable_channel/retry_manager.ts b/packages/sdk/src/reliable_channel/retry_manager.ts index 00426fd854..199b0fa80d 100644 --- a/packages/sdk/src/reliable_channel/retry_manager.ts +++ b/packages/sdk/src/reliable_channel/retry_manager.ts @@ -24,9 +24,17 @@ export class RetryManager { const timeout = this.timeouts.get(id); if (timeout) { clearTimeout(timeout); + this.timeouts.delete(id); } } + public stopAllRetries(): void { + for (const [_id, timeout] of this.timeouts.entries()) { + clearTimeout(timeout); + } + this.timeouts.clear(); + } + public startRetries(id: string, retry: () => void | Promise): void { this.retry(id, retry, 0); } @@ -36,7 +44,7 @@ export class RetryManager { retry: () => void | Promise, attemptNumber: number ): void { - clearTimeout(this.timeouts.get(id)); + this.stopRetries(id); if (attemptNumber < this.maxRetryNumber) { const interval = setTimeout(() => { void retry();