Skip to content

Commit

Permalink
Fix timeout clear
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben-Rey committed Oct 11, 2023
1 parent 6f5a465 commit a995a1e
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
2 changes: 1 addition & 1 deletion packages/massa-web3/src/utils/time.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ export class Timeout {
}
private isCleared: boolean;
private isCalled: boolean;
private timeoutHook: NodeJS.Timeout;
private timeoutHook: ReturnType<typeof setTimeout>;

/**
* Clears the timeout so that the callback function is not called.
Expand Down
12 changes: 6 additions & 6 deletions packages/massa-web3/src/web3/EventPoller.ts
Original file line number Diff line number Diff line change
Expand Up @@ -113,9 +113,9 @@ export class EventPoller extends EventEmitter {
}

// reset the interval.
this.timeoutId = new Timeout(this.pollIntervalMillis, () =>
this.callback(),
);
this.timeoutId = new Timeout(this.pollIntervalMillis, () => {
this.callback();
});
}

/**
Expand All @@ -133,9 +133,9 @@ export class EventPoller extends EventEmitter {
if (this.timeoutId) {
return;
}
this.timeoutId = new Timeout(this.pollIntervalMillis, () =>
that.callback(),
);
this.timeoutId = new Timeout(this.pollIntervalMillis, () => {
that.callback();
});
}

/**
Expand Down

0 comments on commit a995a1e

Please sign in to comment.