@eclesia/indexer-engine 2.4.1 → 2.4.3
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
|
@@ -34,7 +34,6 @@ export declare class EcleciaIndexer extends EclesiaEmitter {
|
|
|
34
34
|
private blockListener;
|
|
35
35
|
private isMinimal;
|
|
36
36
|
connect(): Promise<boolean>;
|
|
37
|
-
private debugTimes;
|
|
38
37
|
start(): Promise<void>;
|
|
39
38
|
asyncEmit: EmitFunc<keyof WithHeightAndUUID<EventMap>>;
|
|
40
39
|
private processBlock;
|
|
@@ -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,GAAG,EAAE,OAAO,CAAC,MAAM,CAAC;IAE3B,OAAO,CAAC,SAAS,CAAiC;IAElD,OAAO,CAAC,WAAW,CAEjB;IAEF,OAAO,CAAC,YAAY,CAA6D;g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,EAAE,UAAU,EAAE,MAAM,CAAC,EAAE,MAAM;IAoBrE,OAAO,CAAC,gBAAgB;YAqCV,YAAY;IAY1B,OAAO,CAAC,WAAW;YAQL,cAAc;YAyBd,cAAc;YAuBd,YAAY;CAiD3B"}
|
package/dist/indexer/index.js
CHANGED
|
@@ -54,7 +54,6 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
54
54
|
};
|
|
55
55
|
this.asyncEmit = async (type, event) => {
|
|
56
56
|
event.uuid = (0, uuid_1.v4)();
|
|
57
|
-
this.debugTimes();
|
|
58
57
|
// More than 1 listener can be registered for an event type
|
|
59
58
|
// Fortunately these are all set up during module init() so we have a consistent count
|
|
60
59
|
// so we can count responses to resolve when complete
|
|
@@ -73,7 +72,6 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
73
72
|
if (listenersResponded == listenerCount) {
|
|
74
73
|
// All listeners have done their thing so we can remove listener, resolve and continue execution
|
|
75
74
|
this.off("uuid", returnFunc);
|
|
76
|
-
this.debugTimes(type);
|
|
77
75
|
resolve();
|
|
78
76
|
}
|
|
79
77
|
}
|
|
@@ -164,18 +162,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
164
162
|
return false;
|
|
165
163
|
}
|
|
166
164
|
}
|
|
167
|
-
debugTimes(label) {
|
|
168
|
-
if (this.debugTime && this.config.logLevel == "debug") {
|
|
169
|
-
const hrTime = process.hrtime(this.debugTime);
|
|
170
|
-
this.log.debug("Process time for " + label + ": " + Number(hrTime[0] * 1000 + hrTime[1] / 1000000) + "ms");
|
|
171
|
-
this.debugTime = null;
|
|
172
|
-
}
|
|
173
|
-
else {
|
|
174
|
-
this.debugTime = process.hrtime();
|
|
175
|
-
}
|
|
176
|
-
}
|
|
177
165
|
async start() {
|
|
178
|
-
this.debugTime = null;
|
|
179
166
|
if (!this.initialized) {
|
|
180
167
|
try {
|
|
181
168
|
if (this.config.init) {
|
|
@@ -272,6 +259,9 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
272
259
|
height,
|
|
273
260
|
timestamp
|
|
274
261
|
});
|
|
262
|
+
if (global.gc) {
|
|
263
|
+
global.gc();
|
|
264
|
+
}
|
|
275
265
|
}
|
|
276
266
|
if (height % 100 == 0) {
|
|
277
267
|
await this.asyncEmit("periodic/100", {
|
|
@@ -311,6 +301,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
311
301
|
}
|
|
312
302
|
}
|
|
313
303
|
async processBlock(block, block_results, validators) {
|
|
304
|
+
const processStart = process.hrtime();
|
|
314
305
|
const height = block.block.header.height;
|
|
315
306
|
this.log.debug("Processing block: %d", height);
|
|
316
307
|
this.log.silly("Started db tx");
|
|
@@ -417,6 +408,9 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
417
408
|
timestamp
|
|
418
409
|
});
|
|
419
410
|
this.log.silly("Modules handled end_block events");
|
|
411
|
+
const processEnd = process.hrtime(processStart);
|
|
412
|
+
const processTime = processEnd[0] * 1000 + processEnd[1] / 1000000;
|
|
413
|
+
this.log.debug("Processed block %d in %d ms", height, processTime.toFixed(2));
|
|
420
414
|
}
|
|
421
415
|
async fetcher() {
|
|
422
416
|
let error = false;
|