Skip to content

Commit

Permalink
Add comments for clarity
Browse files Browse the repository at this point in the history
  • Loading branch information
matthewwalsh0 committed Feb 2, 2024
1 parent 95b8442 commit f93d05b
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/PollingBlockTracker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -245,6 +245,8 @@ export class PollingBlockTracker
}

private _start() {
// Intentionally not awaited as this starts the polling via a timeout chain.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._updateAndQueue();
}

Expand Down Expand Up @@ -280,6 +282,10 @@ export class PollingBlockTracker
return res.result;
}

/**
* The core polling function that runs after each interval.
* Updates the latest block and then queues the next update.
*/
private async _updateAndQueue() {
let interval = this._pollingInterval;

Expand Down Expand Up @@ -308,6 +314,8 @@ export class PollingBlockTracker
this._clearPollingTimeout();

const timeoutRef = setTimeout(() => {
// Intentionally not awaited as this just continues the polling loop.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this._updateAndQueue();
}, interval);

Expand Down

0 comments on commit f93d05b

Please sign in to comment.