@secondlayer/subgraphs 4.0.1 → 4.0.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/src/index.js +19 -4
- package/dist/src/index.js.map +4 -4
- package/dist/src/runtime/block-processor.d.ts +5 -0
- package/dist/src/runtime/block-processor.js +15 -1
- package/dist/src/runtime/block-processor.js.map +3 -3
- package/dist/src/runtime/catchup.js +17 -2
- package/dist/src/runtime/catchup.js.map +4 -4
- package/dist/src/runtime/processor.js +19 -4
- package/dist/src/runtime/processor.js.map +4 -4
- package/dist/src/runtime/reindex.js +19 -4
- package/dist/src/runtime/reindex.js.map +4 -4
- package/dist/src/runtime/reorg.js +17 -2
- package/dist/src/runtime/reorg.js.map +4 -4
- package/dist/src/runtime/replay.js +6 -5
- package/dist/src/runtime/replay.js.map +3 -3
- package/dist/src/service.js +19 -4
- package/dist/src/service.js.map +4 -4
- package/package.json +3 -2
|
@@ -1653,6 +1653,7 @@ function matchSources(sources, transactions, events, traitContracts = new Map, f
|
|
|
1653
1653
|
// src/runtime/block-processor.ts
|
|
1654
1654
|
import { getTargetDb } from "@secondlayer/shared/db";
|
|
1655
1655
|
import { resolveTraitContractIds } from "@secondlayer/shared/db/queries/contracts";
|
|
1656
|
+
import { recordGapBatch } from "@secondlayer/shared/db/queries/subgraph-gaps";
|
|
1656
1657
|
import { advanceOperationCursor } from "@secondlayer/shared/db/queries/subgraph-operations";
|
|
1657
1658
|
import {
|
|
1658
1659
|
recordLiveError,
|
|
@@ -2805,6 +2806,19 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
|
|
|
2805
2806
|
throw new LiveCursorRaceLostError(subgraphName, blockHeight);
|
|
2806
2807
|
}
|
|
2807
2808
|
}
|
|
2809
|
+
if (rr.errors > 0 && !rewind) {
|
|
2810
|
+
if (opts?.subgraphId) {
|
|
2811
|
+
await recordGapBatch(tx, opts.subgraphId, subgraphName, [
|
|
2812
|
+
{ start: blockHeight, end: blockHeight, reason: "processing_error" }
|
|
2813
|
+
]);
|
|
2814
|
+
} else {
|
|
2815
|
+
logger7.warn("Block errors not recorded as a gap — no subgraphId", {
|
|
2816
|
+
subgraph: subgraphName,
|
|
2817
|
+
blockHeight,
|
|
2818
|
+
errors: rr.errors
|
|
2819
|
+
});
|
|
2820
|
+
}
|
|
2821
|
+
}
|
|
2808
2822
|
if (rr.processed > 0 || rr.errors > 0) {
|
|
2809
2823
|
const lastError = rr.errors > 0 ? `${rr.errors} error(s) at block ${blockHeight}` : undefined;
|
|
2810
2824
|
await recordSubgraphProcessed(tx, subgraphName, rr.processed, rr.errors, lastError);
|
|
@@ -3196,7 +3210,8 @@ async function catchUpSubgraph(subgraph, subgraphName) {
|
|
|
3196
3210
|
throw new ReorgEpochChangedError(subgraphName);
|
|
3197
3211
|
}
|
|
3198
3212
|
return processBlockWithRetry(subgraph, subgraphName, height, {
|
|
3199
|
-
preloaded
|
|
3213
|
+
preloaded,
|
|
3214
|
+
subgraphId: subgraphRow.id
|
|
3200
3215
|
});
|
|
3201
3216
|
});
|
|
3202
3217
|
} catch (err) {
|
|
@@ -3255,7 +3270,7 @@ async function catchUpSubgraph(subgraph, subgraphName) {
|
|
|
3255
3270
|
import { getErrorMessage as getErrorMessage3 } from "@secondlayer/shared";
|
|
3256
3271
|
import { getRawClient, getTargetDb as getTargetDb3 } from "@secondlayer/shared/db";
|
|
3257
3272
|
import {
|
|
3258
|
-
recordGapBatch,
|
|
3273
|
+
recordGapBatch as recordGapBatch2,
|
|
3259
3274
|
resolveGaps
|
|
3260
3275
|
} from "@secondlayer/shared/db/queries/subgraph-gaps";
|
|
3261
3276
|
import {
|
|
@@ -3538,7 +3553,7 @@ async function processBlockRange(def, opts) {
|
|
|
3538
3553
|
}
|
|
3539
3554
|
if (batchFailedBlocks.length > 0 && opts.subgraphId) {
|
|
3540
3555
|
const gaps = coalesceFailedBlocks(batchFailedBlocks);
|
|
3541
|
-
await
|
|
3556
|
+
await recordGapBatch2(targetDb, opts.subgraphId, subgraphName, gaps).catch((err) => {
|
|
3542
3557
|
logger10.warn("Failed to record subgraph gaps", {
|
|
3543
3558
|
subgraph: subgraphName,
|
|
3544
3559
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -4377,5 +4392,5 @@ export {
|
|
|
4377
4392
|
startSubgraphOperationRunner
|
|
4378
4393
|
};
|
|
4379
4394
|
|
|
4380
|
-
//# debugId=
|
|
4395
|
+
//# debugId=861951DF1312D9D664756E2164756E21
|
|
4381
4396
|
//# sourceMappingURL=processor.js.map
|