mirror of
https://github.com/logos-messaging/js-waku.git
synced 2026-02-05 14:33:26 +00:00
fix: add stopAllRetries method to RetryManager for proper cleanup
This commit is contained in:
parent
404d590a86
commit
9793b40275
@ -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();
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user