Skip to content

Commit

Permalink
handled "provider started to reconnect error" (#5820)
Browse files Browse the repository at this point in the history
* fix

* add change log
  • Loading branch information
avkos authored Feb 9, 2023
1 parent 5009bdd commit 8621030
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 3 deletions.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -644,4 +644,5 @@ Released with 1.0.0-beta.37 code base.

### Fixed

- Fixed skipped ws-ganache tests (#5759)
- Fixed skipped ws-ganache tests (#5759)
- Fixed "provider started to reconnect error" in web3-provider-ws (#5820)
8 changes: 6 additions & 2 deletions packages/web3-providers-ws/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -392,8 +392,12 @@ WebsocketProvider.prototype.reconnect = function () {

if (this.responseQueue.size > 0) {
this.responseQueue.forEach(function (request, key) {
request.callback(errors.PendingRequestsOnReconnectingError());
_this.responseQueue.delete(key);
try{
_this.responseQueue.delete(key);
request.callback(errors.PendingRequestsOnReconnectingError())
}catch (e) {
console.error("Error encountered in reconnect: ", e)
}
});
}

Expand Down

0 comments on commit 8621030

Please sign in to comment.