@eclesia/indexer-engine 2.5.12 → 2.5.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/indexer/index.d.ts
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/indexer/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,WAAW,EAA4B,MAAM,wBAAwB,CAAC;AAkBpH,OAAO,OAAO,MAAM,SAAS,CAAC;AAE9B,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAE5C,OAAO,EAAc,oBAAoB,EAAE,QAAQ,EAAqB,iBAAiB,EAAE,MAAM,UAAU,CAAC;AAI5G,eAAO,MAAM,oBAAoB;;;;;cAKX,oBAAoB,CAAC,UAAU,CAAC;;;;;;;8BAO1B,OAAO;CAClC,CAAC;AAEF,qBAAa,cAAe,SAAQ,cAAc;IAChD,OAAO,CAAC,MAAM,CAAuB;IAErC,OAAO,CAAC,OAAO,CAAkB;IAEjC,OAAO,CAAC,UAAU,CAAa;IAE/B,OAAO,CAAC,YAAY,CAAU;IAE9B,OAAO,CAAC,eAAe,CAAU;IAEjC,OAAO,CAAC,WAAW,CAAS;IAE5B,OAAO,CAAC,UAAU,CAAK;IAEhB,MAAM,EAAG,WAAW,CAAC;IAErB,WAAW,EAAG,WAAW,CAAC;IAE1B,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;IAE3B,OAAO,CAAC,SAAS,CAAiC;IAElD,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAA6D;gBAErE,MAAM,EAAE,oBAAoB;IAyDxC,OAAO,CAAC,SAAS;IAIjB,OAAO,CAAC,aAAa,CAInB;IAEF,OAAO,CAAC,SAAS;IAQJ,OAAO;
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/indexer/index.ts"],"names":[],"mappings":"AAGA,OAAO,EAAuC,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AC,WAAW;YAQL,cAAc;YAyBd,cAAc;YAuBd,YAAY;CAiD3B"}
|
package/dist/indexer/index.js
CHANGED
|
@@ -42,6 +42,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
42
42
|
super();
|
|
43
43
|
this.initialized = false;
|
|
44
44
|
this.retryCount = 0;
|
|
45
|
+
this.rpcOk = true;
|
|
45
46
|
this.debugTime = null;
|
|
46
47
|
this.healthCheck = {
|
|
47
48
|
status: "CONNECTING"
|
|
@@ -157,10 +158,12 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
157
158
|
this.log.info("Connected to RPC for ad hoc queries");
|
|
158
159
|
this.blockClient = await (0, tendermint_rpc_2.connectComet)(this.config.rpcUrl);
|
|
159
160
|
this.log.info("Connected to RPC for block & validator info");
|
|
161
|
+
this.rpcOk = true;
|
|
160
162
|
return true;
|
|
161
163
|
}
|
|
162
164
|
catch (error) {
|
|
163
165
|
this.log.error(error);
|
|
166
|
+
this.rpcOk = false;
|
|
164
167
|
return false;
|
|
165
168
|
}
|
|
166
169
|
}
|
|
@@ -224,6 +227,9 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
224
227
|
while (this.blockQueue.size() > 0) {
|
|
225
228
|
// await the dequeued promise is essentially awaiting fetched data for that block
|
|
226
229
|
try {
|
|
230
|
+
if (!this.rpcOk) {
|
|
231
|
+
throw new Error("RPC not responding");
|
|
232
|
+
}
|
|
227
233
|
// Index block inside a db transaction to ensure data consistency
|
|
228
234
|
await this.config.beginTransaction();
|
|
229
235
|
this.log.silly("Started db tx");
|
|
@@ -433,7 +439,11 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
433
439
|
const toIndex = Promise.race([Promise.all([
|
|
434
440
|
this.blockClient.block(i),
|
|
435
441
|
this.blockClient.blockResults(i)
|
|
436
|
-
]), timeoutPromise])
|
|
442
|
+
]), timeoutPromise]).catch((e) => {
|
|
443
|
+
this.log.error("Error fetching block: " + i + " : " + e);
|
|
444
|
+
this.rpcOk = false;
|
|
445
|
+
return Promise.resolve([]);
|
|
446
|
+
});
|
|
437
447
|
this.blockQueue.enqueue(toIndex);
|
|
438
448
|
}
|
|
439
449
|
else {
|
|
@@ -446,10 +456,17 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
446
456
|
this.blockClient.block(i),
|
|
447
457
|
this.blockClient.blockResults(i),
|
|
448
458
|
this.callABCI("/cosmos.staking.v1beta1.Query/Validators", vals, i, false)
|
|
449
|
-
]), timeoutPromise])
|
|
459
|
+
]), timeoutPromise]).catch((e) => {
|
|
460
|
+
this.log.error("Error fetching block: " + i + " : " + e);
|
|
461
|
+
this.rpcOk = false;
|
|
462
|
+
return Promise.resolve([]);
|
|
463
|
+
});
|
|
450
464
|
this.blockQueue.enqueue(toIndex);
|
|
451
465
|
}
|
|
452
466
|
await this.blockQueue.continue();
|
|
467
|
+
if (!this.rpcOk) {
|
|
468
|
+
throw new Error("RPC not responding");
|
|
469
|
+
}
|
|
453
470
|
}
|
|
454
471
|
catch (e) {
|
|
455
472
|
this.log.error(e);
|
|
@@ -473,11 +490,13 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
473
490
|
return abciq.value;
|
|
474
491
|
}
|
|
475
492
|
else {
|
|
493
|
+
this.rpcOk = false;
|
|
476
494
|
this.setStatus("FAILED");
|
|
477
495
|
throw new Error("RPC not responding. Query at: " + path);
|
|
478
496
|
}
|
|
479
497
|
}
|
|
480
498
|
catch (_e) {
|
|
499
|
+
this.rpcOk = false;
|
|
481
500
|
this.setStatus("FAILED");
|
|
482
501
|
throw new Error("RPC not responding. Query at: " + path);
|
|
483
502
|
}
|