-
-
Notifications
You must be signed in to change notification settings - Fork 82
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix: internal listeners infinite retry loop (#284)
* fix: internal listeners infinite retry loop * edit `CHANGELOG` * refactor: rename to `#internalEventListeners` * refactor: simplify listener equality check Co-authored-by: Mark Stacey <[email protected]> * Revert "refactor: simplify listener equality check" This reverts commit eb5514d. * apply fix to `SubscribeBlockTracker` * fix: reject `getLatestBlock` promise when block tracker stops * fix: remove on error internal listener * Suggestion to simplify prevention of dangling Promise on destroy (#286) * Suggestion to simplify prevention of dangling Promise on destroy The `fix/internal-listeners` branch has a number of changes intended to ensure we don't have a dangling unresolved Promise when the block tracker is destroyed. This solution involved adding an additional listener to capture errors, and it involved not removing internal listeners when `destroy` is called. This required changes to some logging in `_updateAndQueue` as well. This commit is an alternative solution that avoids the use of internal listeners, thus avoiding much of the complexity in the previous solution. Instead an internal deferred Promise is used. This also might be slightly more efficient when `getLatestBlock` is called repeatedly, as we can reuse the same listener rather than creating a new one each time. * Unset pending latest block after it has resolved * fix: operand of a delete operator cannot be a private identifier * test: change error message * refactor: add helper methods * refactor: simplify `SubscribeBlockTracker` * Update CHANGELOG.md Co-authored-by: Mark Stacey <[email protected]> * fix: `SubscribeBlockTracker` throws when subscription fails * test: remove broken case * test: add case for returning the same promise * test: add coverage for `PollingBlockTracker` * test: add coverage for `SubscribeBlockTracker` * test: remove redundant tests * test: check promises return for `SubscribeBlockTracker` * rename test case Co-authored-by: Elliot Winkler <[email protected]> * test: spy on `provider.request` * edit changelog entry * test: set automatic timer calls to 2 --------- Co-authored-by: Mark Stacey <[email protected]> Co-authored-by: Elliot Winkler <[email protected]>
- Loading branch information
1 parent
985b19c
commit b41e033
Showing
5 changed files
with
318 additions
and
64 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.