Stall block polling bootstrap when the network is down (#3924).
This commit is contained in:
parent
d661f70f3f
commit
603d47496e
@ -50,7 +50,10 @@ export class PollingBlockSubscriber implements Subscriber {
|
||||
set pollingInterval(value: number) { this.#interval = value; }
|
||||
|
||||
async #poll(): Promise<void> {
|
||||
try {
|
||||
const blockNumber = await this.#provider.getBlockNumber();
|
||||
|
||||
// Bootstrap poll to setup our initial block number
|
||||
if (this.#blockNumber === -2) {
|
||||
this.#blockNumber = blockNumber;
|
||||
return;
|
||||
@ -69,6 +72,12 @@ export class PollingBlockSubscriber implements Subscriber {
|
||||
this.#blockNumber = blockNumber;
|
||||
}
|
||||
|
||||
} catch (error) {
|
||||
// @TODO: Minor bump, add an "error" event to let subscribers
|
||||
// know things went awry.
|
||||
//console.log(error);
|
||||
}
|
||||
|
||||
// We have been stopped
|
||||
if (this.#poller == null) { return; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user