@secondlayer/subgraphs 4.0.2 → 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 +1 -1
package/dist/src/index.js
CHANGED
|
@@ -1868,6 +1868,7 @@ function matchSources(sources, transactions, events, traitContracts = new Map, f
|
|
|
1868
1868
|
// src/runtime/block-processor.ts
|
|
1869
1869
|
import { getTargetDb } from "@secondlayer/shared/db";
|
|
1870
1870
|
import { resolveTraitContractIds } from "@secondlayer/shared/db/queries/contracts";
|
|
1871
|
+
import { recordGapBatch } from "@secondlayer/shared/db/queries/subgraph-gaps";
|
|
1871
1872
|
import { advanceOperationCursor } from "@secondlayer/shared/db/queries/subgraph-operations";
|
|
1872
1873
|
import {
|
|
1873
1874
|
recordLiveError,
|
|
@@ -3020,6 +3021,19 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
|
|
|
3020
3021
|
throw new LiveCursorRaceLostError(subgraphName, blockHeight);
|
|
3021
3022
|
}
|
|
3022
3023
|
}
|
|
3024
|
+
if (rr.errors > 0 && !rewind) {
|
|
3025
|
+
if (opts?.subgraphId) {
|
|
3026
|
+
await recordGapBatch(tx, opts.subgraphId, subgraphName, [
|
|
3027
|
+
{ start: blockHeight, end: blockHeight, reason: "processing_error" }
|
|
3028
|
+
]);
|
|
3029
|
+
} else {
|
|
3030
|
+
logger7.warn("Block errors not recorded as a gap — no subgraphId", {
|
|
3031
|
+
subgraph: subgraphName,
|
|
3032
|
+
blockHeight,
|
|
3033
|
+
errors: rr.errors
|
|
3034
|
+
});
|
|
3035
|
+
}
|
|
3036
|
+
}
|
|
3023
3037
|
if (rr.processed > 0 || rr.errors > 0) {
|
|
3024
3038
|
const lastError = rr.errors > 0 ? `${rr.errors} error(s) at block ${blockHeight}` : undefined;
|
|
3025
3039
|
await recordSubgraphProcessed(tx, subgraphName, rr.processed, rr.errors, lastError);
|
|
@@ -3411,7 +3425,8 @@ async function catchUpSubgraph(subgraph, subgraphName) {
|
|
|
3411
3425
|
throw new ReorgEpochChangedError(subgraphName);
|
|
3412
3426
|
}
|
|
3413
3427
|
return processBlockWithRetry(subgraph, subgraphName, height, {
|
|
3414
|
-
preloaded
|
|
3428
|
+
preloaded,
|
|
3429
|
+
subgraphId: subgraphRow.id
|
|
3415
3430
|
});
|
|
3416
3431
|
});
|
|
3417
3432
|
} catch (err) {
|
|
@@ -3470,7 +3485,7 @@ async function catchUpSubgraph(subgraph, subgraphName) {
|
|
|
3470
3485
|
import { getErrorMessage as getErrorMessage3 } from "@secondlayer/shared";
|
|
3471
3486
|
import { getRawClient, getTargetDb as getTargetDb3 } from "@secondlayer/shared/db";
|
|
3472
3487
|
import {
|
|
3473
|
-
recordGapBatch,
|
|
3488
|
+
recordGapBatch as recordGapBatch2,
|
|
3474
3489
|
resolveGaps
|
|
3475
3490
|
} from "@secondlayer/shared/db/queries/subgraph-gaps";
|
|
3476
3491
|
import {
|
|
@@ -3753,7 +3768,7 @@ async function processBlockRange(def, opts) {
|
|
|
3753
3768
|
}
|
|
3754
3769
|
if (batchFailedBlocks.length > 0 && opts.subgraphId) {
|
|
3755
3770
|
const gaps = coalesceFailedBlocks(batchFailedBlocks);
|
|
3756
|
-
await
|
|
3771
|
+
await recordGapBatch2(targetDb, opts.subgraphId, subgraphName, gaps).catch((err) => {
|
|
3757
3772
|
logger10.warn("Failed to record subgraph gaps", {
|
|
3758
3773
|
subgraph: subgraphName,
|
|
3759
3774
|
error: err instanceof Error ? err.message : String(err)
|
|
@@ -5257,5 +5272,5 @@ export {
|
|
|
5257
5272
|
ChainReadError
|
|
5258
5273
|
};
|
|
5259
5274
|
|
|
5260
|
-
//# debugId=
|
|
5275
|
+
//# debugId=49A02A651514C58F64756E2164756E21
|
|
5261
5276
|
//# sourceMappingURL=index.js.map
|