@eclesia/indexer-engine 2.5.8 → 2.5.10

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.
@@ -230,7 +230,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
230
230
  if (this.isMinimal(this.blockQueue)) {
231
231
  const toProcess = await this.blockQueue.dequeue();
232
232
  this.log.silly("Retrieved block data");
233
- if (!toProcess) {
233
+ if (!toProcess || !toProcess[0] || !toProcess[1]) {
234
234
  throw new Error("Could not fetch block");
235
235
  }
236
236
  height = toProcess[0].block.header.height;
@@ -240,7 +240,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
240
240
  else {
241
241
  const toProcess = await this.blockQueue.dequeue();
242
242
  this.log.silly("Retrieved block data");
243
- if (!toProcess) {
243
+ if (!toProcess || !toProcess[0] || !toProcess[1] || !toProcess[2]) {
244
244
  throw new Error("Could not fetch block");
245
245
  }
246
246
  this.log.silly("Decoded block");
@@ -296,7 +296,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
296
296
  if (this.retryCount < 3) {
297
297
  this.log.debug("Indexer retryCount: " + this.retryCount);
298
298
  this.log.info("Indexer is restarting");
299
- this.start();
299
+ setTimeout(() => this.start(), this.retryCount * 5000);
300
300
  }
301
301
  }
302
302
  async processBlock(block, block_results, validators) {
@@ -458,21 +458,21 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
458
458
  }
459
459
  }
460
460
  async callABCI(path, data, height, adHoc = true) {
461
- const timeout = new Promise((resolve) => {
462
- setTimeout(resolve, 30000);
463
- });
464
- const abciq = await Promise.race([
465
- (adHoc ? this.client : this.blockClient).abciQuery({
461
+ try {
462
+ const abciq = await (adHoc ? this.client : this.blockClient).abciQuery({
466
463
  path,
467
464
  data,
468
465
  height: height
469
- }),
470
- timeout
471
- ]);
472
- if (abciq) {
473
- return abciq.value;
466
+ });
467
+ if (abciq) {
468
+ return abciq.value;
469
+ }
470
+ else {
471
+ this.setStatus("FAILED");
472
+ throw new Error("RPC not responding. Query at: " + path);
473
+ }
474
474
  }
475
- else {
475
+ catch (_e) {
476
476
  this.setStatus("FAILED");
477
477
  throw new Error("RPC not responding. Query at: " + path);
478
478
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@eclesia/indexer-engine",
3
- "version": "2.5.8",
3
+ "version": "2.5.10",
4
4
  "description": "Core eclesia indexer engine",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",