@secondlayer/subgraphs 3.14.0 → 3.14.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.
@@ -1335,6 +1335,7 @@ import { resolveTraitContractIds } from "@secondlayer/shared/db/queries/contract
1335
1335
  import { advanceOperationCursor } from "@secondlayer/shared/db/queries/subgraph-operations";
1336
1336
  import {
1337
1337
  isByoSubgraph,
1338
+ recordLiveProgress,
1338
1339
  recordSubgraphProcessed,
1339
1340
  resolveSubgraphDb,
1340
1341
  updateSubgraphStatus
@@ -2029,7 +2030,7 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2029
2030
  result.matched = matched.length;
2030
2031
  if (matched.length === 0) {
2031
2032
  if (!opts?.skipProgressUpdate) {
2032
- await updateSubgraphStatus(targetDb, subgraphName, "active", blockHeight);
2033
+ await recordLiveProgress(targetDb, subgraphName, blockHeight);
2033
2034
  }
2034
2035
  return result;
2035
2036
  }
@@ -2052,8 +2053,11 @@ async function processBlock(subgraph, subgraphName, blockHeight, opts) {
2052
2053
  const applyProgress = async (tx, rr) => {
2053
2054
  if (opts?.skipProgressUpdate)
2054
2055
  return;
2055
- const status = rr.errors > 0 && rr.processed === 0 ? "error" : "active";
2056
- await updateSubgraphStatus(tx, subgraphName, status, blockHeight);
2056
+ if (rr.errors > 0 && rr.processed === 0) {
2057
+ await updateSubgraphStatus(tx, subgraphName, "error", blockHeight);
2058
+ } else {
2059
+ await recordLiveProgress(tx, subgraphName, blockHeight);
2060
+ }
2057
2061
  if (rr.processed > 0 || rr.errors > 0) {
2058
2062
  const lastError = rr.errors > 0 ? `${rr.errors} error(s) at block ${blockHeight}` : undefined;
2059
2063
  await recordSubgraphProcessed(tx, subgraphName, rr.processed, rr.errors, lastError);
@@ -2564,7 +2568,11 @@ async function reindexSubgraph(def, opts) {
2564
2568
  for (const stmt of statements) {
2565
2569
  await client.unsafe(stmt);
2566
2570
  }
2567
- logger6.info("Schema recreated for reindex", { subgraph: subgraphName });
2571
+ await updateSubgraphStatus2(targetDb, subgraphName, "reindexing", Math.max(0, fromBlock - 1));
2572
+ logger6.info("Schema recreated for reindex", {
2573
+ subgraph: subgraphName,
2574
+ cursorResetTo: Math.max(0, fromBlock - 1)
2575
+ });
2568
2576
  await targetDb.updateTable("subgraphs").set({
2569
2577
  last_processed_block: initialReindexProgressBlock(fromBlock),
2570
2578
  reindex_from_block: fromBlock,
@@ -3511,5 +3519,5 @@ var shutdown = async () => {
3511
3519
  process.on("SIGINT", shutdown);
3512
3520
  process.on("SIGTERM", shutdown);
3513
3521
 
3514
- //# debugId=B3292FF11E73449C64756E2164756E21
3522
+ //# debugId=86CD0D48124A797164756E2164756E21
3515
3523
  //# sourceMappingURL=service.js.map