@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.
@@ -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) {
@@ -3259,5 +3274,5 @@ export {
3259
3274
  bumpReorgEpoch
3260
3275
  };
3261
3276
 
3262
- //# debugId=0896A0EF0EFDC27C64756E2164756E21
3277
+ //# debugId=94C81D38A475A3B564756E2164756E21
3263
3278
  //# sourceMappingURL=catchup.js.map