Skip to content

Commit

Permalink
fix: avoid uncaught exception when polling validator indices (#6891)
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig authored Jun 18, 2024
1 parent 7e35c92 commit 89ab742
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions packages/validator/src/services/indices.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,10 +83,8 @@ export class IndicesService {
return this.pollValidatorIndicesPromise;
}

this.pollValidatorIndicesPromise = this.pollValidatorIndicesInternal(pubkeysHex);
// Once the pollValidatorIndicesInternal() resolves or rejects null the cached promise so it can be called again.
// eslint-disable-next-line @typescript-eslint/no-floating-promises
this.pollValidatorIndicesPromise.finally(() => {
this.pollValidatorIndicesPromise = this.pollValidatorIndicesInternal(pubkeysHex).finally(() => {
// Once the pollValidatorIndicesInternal() resolves or rejects null the cached promise so it can be called again.
this.pollValidatorIndicesPromise = null;
});
return this.pollValidatorIndicesPromise;
Expand Down

0 comments on commit 89ab742

Please sign in to comment.