fix: add stopAllRetries method to RetryManager for proper cleanup

This commit is contained in:
Levente Kiss 2025-10-31 18:39:15 +13:00
parent 404d590a86
commit 9793b40275

View File

@ -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>): void {
this.retry(id, retry, 0);
}
@ -36,7 +44,7 @@ export class RetryManager {
retry: () => void | Promise<void>,
attemptNumber: number
): void {
clearTimeout(this.timeouts.get(id));
this.stopRetries(id);
if (attemptNumber < this.maxRetryNumber) {
const interval = setTimeout(() => {
void retry();