aboutsummaryrefslogtreecommitdiffstats
path: root/lib/providermanager.js
diff options
context:
space:
mode:
authorMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-06 01:20:43 +0800
committerMarek Kotewicz <marek.kotewicz@gmail.com>2015-02-06 01:20:43 +0800
commit82cc5f63aef10c2eb7896e2ecf9dbd0af3739785 (patch)
treeab9a13dd282d4ca100d043392e5227200e6c7616 /lib/providermanager.js
parentf3e1797153ebf5b19ca3e154cf1240be738e4f08 (diff)
downloadgo-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.js31
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();