Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

clearSubscriptions shouldn't throw an error if no subscriptions do exist #3246

Merged
merged 3 commits into from
Nov 29, 2019
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -109,3 +109,5 @@ Released with 1.0.0-beta.37 code base.
- ``getPendingTransactions`` added to web3-eth package (#3239)

### Fixed

- ``clearSubscriptions`` does no longer throw an error if no running subscriptions do exist (#3246)
12 changes: 7 additions & 5 deletions packages/web3-core-requestmanager/src/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,11 +228,13 @@ RequestManager.prototype.clearSubscriptions = function (keepIsSyncing) {
var _this = this;


// uninstall all subscriptions
Object.keys(this.subscriptions).forEach(function(id){
if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing')
_this.removeSubscription(id);
});
if (this.subscriptions) {
// uninstall all subscriptions
Object.keys(this.subscriptions).forEach(function(id){
if(!keepIsSyncing || _this.subscriptions[id].name !== 'syncing')
_this.removeSubscription(id);
});
}


// reset notification callbacks etc.
Expand Down