Skip to content

Commit

Permalink
improved filter interval
Browse files Browse the repository at this point in the history
  • Loading branch information
frozeman committed Jun 5, 2015
1 parent ddafe00 commit d9ce08e
Show file tree
Hide file tree
Showing 8 changed files with 43 additions and 22 deletions.
15 changes: 11 additions & 4 deletions dist/web3-light.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/web3-light.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3-light.min.js

Large diffs are not rendered by default.

15 changes: 11 additions & 4 deletions dist/web3.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions dist/web3.js.map

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions dist/web3.min.js

Large diffs are not rendered by default.

4 changes: 2 additions & 2 deletions lib/web3/filter.js
Original file line number Diff line number Diff line change
Expand Up @@ -101,8 +101,8 @@ Filter.prototype.watch = function (callback) {
if(self.filterId || self.filterError)
clearInterval(intervalId);

if(self.filterError || !self.filterId)
return;
if(!self.filterId)
return;

self.callbacks.push(callback);

Expand Down
11 changes: 9 additions & 2 deletions lib/web3/requestmanager.js
Original file line number Diff line number Diff line change
Expand Up @@ -226,9 +226,16 @@ RequestManager.prototype.poll = function () {
}

results.map(function (result, index) {
result.callback = self.polls[index].callback;
return result;
// make sure the filter is still installed after arrival of the request
if(self.polls[index]) {
result.callback = self.polls[index].callback;
return result;
} else
return false;
}).filter(function (result) {
if(!result)
return false;

var valid = Jsonrpc.getInstance().isValidResponse(result);
if (!valid) {
result.callback(errors.InvalidResponse(result));
Expand Down

0 comments on commit d9ce08e

Please sign in to comment.