@eclesia/indexer-engine 2.4.0 → 2.4.2
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) {
|
|
@@ -311,6 +298,7 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
311
298
|
}
|
|
312
299
|
}
|
|
313
300
|
async processBlock(block, block_results, validators) {
|
|
301
|
+
const processStart = process.hrtime();
|
|
314
302
|
const height = block.block.header.height;
|
|
315
303
|
this.log.debug("Processing block: %d", height);
|
|
316
304
|
this.log.silly("Started db tx");
|
|
@@ -417,6 +405,9 @@ class EcleciaIndexer extends emitter_1.EclesiaEmitter {
|
|
|
417
405
|
timestamp
|
|
418
406
|
});
|
|
419
407
|
this.log.silly("Modules handled end_block events");
|
|
408
|
+
const processEnd = process.hrtime(processStart);
|
|
409
|
+
const processTime = processEnd[0] * 1000 + processEnd[1] / 1000000;
|
|
410
|
+
this.log.debug("Processed block %d in %d ms", height, processTime.toFixed(2));
|
|
420
411
|
}
|
|
421
412
|
async fetcher() {
|
|
422
413
|
let error = false;
|
|
@@ -26,7 +26,7 @@ class PromiseQueue {
|
|
|
26
26
|
const nextVal = new Promise((resolve, _reject) => {
|
|
27
27
|
this.enqueuer = resolve;
|
|
28
28
|
});
|
|
29
|
-
this.items.
|
|
29
|
+
this.items.push(nextVal);
|
|
30
30
|
if (this.size() > this.batchSize) {
|
|
31
31
|
this.continuePromise = new Promise((resolve, _reject) => {
|
|
32
32
|
this.batcher = resolve;
|
|
@@ -48,7 +48,7 @@ class PromiseQueue {
|
|
|
48
48
|
this.items = [nextVal];
|
|
49
49
|
}
|
|
50
50
|
dequeue() {
|
|
51
|
-
const item = this.items.
|
|
51
|
+
const item = this.items.shift();
|
|
52
52
|
if (this.size() <= this.batchSize) {
|
|
53
53
|
this.batcher(true);
|
|
54
54
|
}
|