Skip to content

Commit

Permalink
Merge pull request #3246 from ethereum/issue/3245
Browse files Browse the repository at this point in the history
clearSubscriptions shouldn't throw an error if no subscriptions do exist
  • Loading branch information
nivida authored Nov 29, 2019
2 parents c9482d7 + 401d6d6 commit 02b695a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 5 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,3 +113,5 @@ Released with 1.0.0-beta.37 code base.
- ``eth-lib`` dependency updated (0.2.7 => 0.2.8) (#3242)

### 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

0 comments on commit 02b695a

Please sign in to comment.