ponder 0.8.7 → 0.8.8
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/bin/ponder.js +43 -18
- package/dist/bin/ponder.js.map +1 -1
- package/package.json +1 -1
- package/src/bin/utils/run.ts +43 -4
- package/src/sync/index.ts +11 -19
package/dist/bin/ponder.js
CHANGED
|
@@ -9926,6 +9926,10 @@ var createSync = async (args) => {
|
|
|
9926
9926
|
limit: getEventsMaxBatchSize
|
|
9927
9927
|
});
|
|
9928
9928
|
consecutiveErrors = 0;
|
|
9929
|
+
args.common.logger.debug({
|
|
9930
|
+
service: "sync",
|
|
9931
|
+
msg: `Fetched ${events.length} events from the database for a ${formatEta(estimateSeconds * 1e3)} range from ${decodeCheckpoint(from).blockTimestamp}`
|
|
9932
|
+
});
|
|
9929
9933
|
for (const network of args.networks) {
|
|
9930
9934
|
updateHistoricalStatus({ events, checkpoint: cursor, network });
|
|
9931
9935
|
}
|
|
@@ -9941,22 +9945,12 @@ var createSync = async (args) => {
|
|
|
9941
9945
|
});
|
|
9942
9946
|
yield { events, checkpoint: to };
|
|
9943
9947
|
from = cursor;
|
|
9944
|
-
const { eta, progress } = await getAppProgress(args.common.metrics);
|
|
9945
|
-
if (events.length > 0) {
|
|
9946
|
-
if (eta === void 0 || progress === void 0) {
|
|
9947
|
-
args.common.logger.info({
|
|
9948
|
-
service: "app",
|
|
9949
|
-
msg: `Indexed ${events.length} events`
|
|
9950
|
-
});
|
|
9951
|
-
} else {
|
|
9952
|
-
args.common.logger.info({
|
|
9953
|
-
service: "app",
|
|
9954
|
-
msg: `Indexed ${events.length} events with ${formatPercentage(progress)} complete and ${formatEta(eta)} remaining`
|
|
9955
|
-
});
|
|
9956
|
-
}
|
|
9957
|
-
}
|
|
9958
9948
|
} catch (error) {
|
|
9959
9949
|
estimateSeconds = Math.max(10, Math.round(estimateSeconds / 10));
|
|
9950
|
+
args.common.logger.debug({
|
|
9951
|
+
service: "sync",
|
|
9952
|
+
msg: `Failed to fetch events from the database, retrying with a ${formatEta(estimateSeconds * 1e3)} range`
|
|
9953
|
+
});
|
|
9960
9954
|
if (++consecutiveErrors > 4)
|
|
9961
9955
|
throw error;
|
|
9962
9956
|
}
|
|
@@ -10525,11 +10519,34 @@ async function run({
|
|
|
10525
10519
|
let lastFlush = Date.now();
|
|
10526
10520
|
for await (const { events, checkpoint } of sync.getEvents()) {
|
|
10527
10521
|
end = checkpoint;
|
|
10528
|
-
const
|
|
10529
|
-
|
|
10530
|
-
|
|
10531
|
-
)
|
|
10522
|
+
const decodedEvents = decodeEvents(common, indexingBuild.sources, events);
|
|
10523
|
+
const result = await handleEvents(decodedEvents, checkpoint);
|
|
10524
|
+
const { eta, progress } = await getAppProgress(common.metrics);
|
|
10525
|
+
if (events.length > 0) {
|
|
10526
|
+
if (eta === void 0 || progress === void 0) {
|
|
10527
|
+
common.logger.info({
|
|
10528
|
+
service: "app",
|
|
10529
|
+
msg: `Indexed ${events.length} events`
|
|
10530
|
+
});
|
|
10531
|
+
} else {
|
|
10532
|
+
common.logger.info({
|
|
10533
|
+
service: "app",
|
|
10534
|
+
msg: `Indexed ${events.length} events with ${formatPercentage(progress)} complete and ${formatEta(eta)} remaining`
|
|
10535
|
+
});
|
|
10536
|
+
}
|
|
10537
|
+
}
|
|
10532
10538
|
if (historicalIndexingStore.isCacheFull() && events.length > 0 || common.options.command === "dev" && lastFlush + 5e3 < Date.now() && events.length > 0) {
|
|
10539
|
+
if (historicalIndexingStore.isCacheFull()) {
|
|
10540
|
+
common.logger.debug({
|
|
10541
|
+
service: "indexing",
|
|
10542
|
+
msg: `Indexing cache has exceeded ${common.options.indexingCacheMaxBytes} MB limit, starting flush`
|
|
10543
|
+
});
|
|
10544
|
+
} else {
|
|
10545
|
+
common.logger.debug({
|
|
10546
|
+
service: "indexing",
|
|
10547
|
+
msg: "Dev server periodic flush triggered, starting flush"
|
|
10548
|
+
});
|
|
10549
|
+
}
|
|
10533
10550
|
await database.finalize({
|
|
10534
10551
|
checkpoint: encodeCheckpoint(zeroCheckpoint)
|
|
10535
10552
|
});
|
|
@@ -10541,6 +10558,10 @@ async function run({
|
|
|
10541
10558
|
checkpoint: events[events.length - 1].checkpoint
|
|
10542
10559
|
});
|
|
10543
10560
|
lastFlush = Date.now();
|
|
10561
|
+
common.logger.debug({
|
|
10562
|
+
service: "indexing",
|
|
10563
|
+
msg: "Completed flush"
|
|
10564
|
+
});
|
|
10544
10565
|
}
|
|
10545
10566
|
await metadataStore.setStatus(sync.getStatus());
|
|
10546
10567
|
if (result.status === "killed") {
|
|
@@ -10552,6 +10573,10 @@ async function run({
|
|
|
10552
10573
|
}
|
|
10553
10574
|
if (isKilled)
|
|
10554
10575
|
return;
|
|
10576
|
+
common.logger.debug({
|
|
10577
|
+
service: "indexing",
|
|
10578
|
+
msg: "Completed all historical events, starting final flush"
|
|
10579
|
+
});
|
|
10555
10580
|
await database.finalize({ checkpoint: encodeCheckpoint(zeroCheckpoint) });
|
|
10556
10581
|
await historicalIndexingStore.flush();
|
|
10557
10582
|
await database.complete({ checkpoint: encodeCheckpoint(zeroCheckpoint) });
|