diff options
author | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-06 01:20:43 +0800 |
---|---|---|
committer | Marek Kotewicz <marek.kotewicz@gmail.com> | 2015-02-06 01:20:43 +0800 |
commit | 82cc5f63aef10c2eb7896e2ecf9dbd0af3739785 (patch) | |
tree | ab9a13dd282d4ca100d043392e5227200e6c7616 /lib/providermanager.js | |
parent | f3e1797153ebf5b19ca3e154cf1240be738e4f08 (diff) | |
download | go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar.gz go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar.bz2 go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar.lz go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar.xz go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.tar.zst go-tangerine-82cc5f63aef10c2eb7896e2ecf9dbd0af3739785.zip |
bring back jsonrpc single method calls in polling
Diffstat (limited to 'lib/providermanager.js')
-rw-r--r-- | lib/providermanager.js | 31 |
1 files changed, 7 insertions, 24 deletions
diff --git a/lib/providermanager.js b/lib/providermanager.js index 55f166bcd..55b072634 100644 --- a/lib/providermanager.js +++ b/lib/providermanager.js @@ -42,33 +42,16 @@ var ProviderManager = function() { var self = this; var poll = function () { - if (self.provider) { - var pollsBatch = self.polls.map(function (data) { - return data.data; - }); + self.polls.forEach(function (data) { + var result = self.send(data.data); - var payload = jsonrpc.toBatchPayload(pollsBatch); - var results = self.provider.send(payload); + if (!(result instanceof Array) || result.length === 0) { + return; + } - self.polls.forEach(function (data, index) { - var result = results[index]; - - if (!jsonrpc.isValidResponse(result)) { - console.log(result); - return; - } + data.callback(result); + }); - result = result.result; - // dont call the callback if result is not an array, or empty one - if (!(result instanceof Array) || result.length === 0) { - return; - } - - data.callback(result); - - }); - - } setTimeout(poll, 1000); }; poll(); |