@secondlayer/subgraphs 4.4.0 → 4.4.1
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/service.js
CHANGED
|
@@ -4951,26 +4951,6 @@ import {
|
|
|
4951
4951
|
targetListenerUrl as targetListenerUrl2
|
|
4952
4952
|
} from "@secondlayer/shared/queue/listener";
|
|
4953
4953
|
|
|
4954
|
-
// src/runtime/hosted-meter.ts
|
|
4955
|
-
var hooks = {};
|
|
4956
|
-
function setHostedMeterHooks(next) {
|
|
4957
|
-
hooks = next;
|
|
4958
|
-
}
|
|
4959
|
-
async function meterBlocksProcessed(accountId, blocks, subgraphName) {
|
|
4960
|
-
if (!accountId || blocks <= 0)
|
|
4961
|
-
return true;
|
|
4962
|
-
if (!hooks.onBlocksProcessed)
|
|
4963
|
-
return true;
|
|
4964
|
-
return hooks.onBlocksProcessed(accountId, blocks, subgraphName);
|
|
4965
|
-
}
|
|
4966
|
-
async function meterDeliveryAttempt(accountId, webhookId) {
|
|
4967
|
-
if (!accountId)
|
|
4968
|
-
return true;
|
|
4969
|
-
if (!hooks.onDeliveryAttempt)
|
|
4970
|
-
return true;
|
|
4971
|
-
return hooks.onDeliveryAttempt(accountId, webhookId);
|
|
4972
|
-
}
|
|
4973
|
-
|
|
4974
4954
|
// src/runtime/streams-reorg-poll.ts
|
|
4975
4955
|
import { getErrorMessage as getErrorMessage5 } from "@secondlayer/shared";
|
|
4976
4956
|
import {
|
|
@@ -5046,8 +5026,7 @@ async function catchUpAll(subgraphs, db, concurrency) {
|
|
|
5046
5026
|
break;
|
|
5047
5027
|
try {
|
|
5048
5028
|
const def = await loadSubgraphDefinition(sg);
|
|
5049
|
-
|
|
5050
|
-
await meterBlocksProcessed(sg.account_id, processed, sg.name);
|
|
5029
|
+
await catchUpSubgraph(def, sg.name);
|
|
5051
5030
|
} catch (err) {
|
|
5052
5031
|
const msg = getErrorMessage6(err);
|
|
5053
5032
|
if (isHandlerNotFoundError(err)) {
|
|
@@ -5182,7 +5161,6 @@ async function runSubgraphOperation(operation, signal) {
|
|
|
5182
5161
|
processed = result.processed;
|
|
5183
5162
|
}
|
|
5184
5163
|
}
|
|
5185
|
-
await meterBlocksProcessed(subgraph.account_id, processed, subgraph.name);
|
|
5186
5164
|
return processed;
|
|
5187
5165
|
}
|
|
5188
5166
|
async function startSubgraphOperationRunner(opts) {
|
|
@@ -5389,7 +5367,6 @@ async function startSubgraphProcessor(opts) {
|
|
|
5389
5367
|
// src/service.ts
|
|
5390
5368
|
import { assertDbSplit, getDb } from "@secondlayer/shared/db";
|
|
5391
5369
|
import { logger as logger15 } from "@secondlayer/shared/logger";
|
|
5392
|
-
import { isPlatformMode } from "@secondlayer/shared/mode";
|
|
5393
5370
|
import { sql as sql7 } from "kysely";
|
|
5394
5371
|
var HEARTBEAT_INTERVAL_MS2 = 30000;
|
|
5395
5372
|
var SERVICE_NAME = "subgraph-processor";
|
|
@@ -5403,20 +5380,6 @@ async function writeHeartbeat() {
|
|
|
5403
5380
|
}
|
|
5404
5381
|
}
|
|
5405
5382
|
assertDbSplit();
|
|
5406
|
-
if (isPlatformMode()) {
|
|
5407
|
-
try {
|
|
5408
|
-
const spec = "@secondlayer/platform/hosted-meters";
|
|
5409
|
-
const mod = await import(spec);
|
|
5410
|
-
setHostedMeterHooks({
|
|
5411
|
-
onBlocksProcessed: mod.onBlocksProcessed,
|
|
5412
|
-
onDeliveryAttempt: mod.onDeliveryAttempt
|
|
5413
|
-
});
|
|
5414
|
-
} catch (err) {
|
|
5415
|
-
logger15.warn("hosted meters not installed; indexing unmetered", {
|
|
5416
|
-
error: err instanceof Error ? err.message : String(err)
|
|
5417
|
-
});
|
|
5418
|
-
}
|
|
5419
|
-
}
|
|
5420
5383
|
var processor = await startSubgraphProcessor({
|
|
5421
5384
|
concurrency: Number.parseInt(process.env.SUBGRAPH_CONCURRENCY ?? "5")
|
|
5422
5385
|
});
|
|
@@ -5431,5 +5394,5 @@ var shutdown = async () => {
|
|
|
5431
5394
|
process.on("SIGINT", shutdown);
|
|
5432
5395
|
process.on("SIGTERM", shutdown);
|
|
5433
5396
|
|
|
5434
|
-
//# debugId=
|
|
5397
|
+
//# debugId=C5C2041C6CD8937664756E2164756E21
|
|
5435
5398
|
//# sourceMappingURL=service.js.map
|