From f34f588a929522f2f99c551c384212ddae21d59a Mon Sep 17 00:00:00 2001 From: alvrs Date: Sat, 4 May 2024 01:30:53 +0100 Subject: [PATCH 1/2] fix(store-indexer): fix distance from follow block metric --- packages/store-indexer/bin/postgres-indexer.ts | 2 +- packages/store-indexer/bin/sqlite-indexer.ts | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/packages/store-indexer/bin/postgres-indexer.ts b/packages/store-indexer/bin/postgres-indexer.ts index d95c4cca50..2e92ef3fdd 100644 --- a/packages/store-indexer/bin/postgres-indexer.ts +++ b/packages/store-indexer/bin/postgres-indexer.ts @@ -71,7 +71,7 @@ async function getDistanceFromFollowBlock(): Promise { getLatestStoredBlockNumber(), publicClient.getBlock({ blockTag: env.FOLLOW_BLOCK_TAG }), ]); - return (latestStoredBlockNumber ?? -1n) - latestFollowBlock.number; + return latestFollowBlock.number - (latestStoredBlockNumber ?? -1n); } const latestStoredBlockNumber = await getLatestStoredBlockNumber(); diff --git a/packages/store-indexer/bin/sqlite-indexer.ts b/packages/store-indexer/bin/sqlite-indexer.ts index 3b55093363..e2198cbec6 100644 --- a/packages/store-indexer/bin/sqlite-indexer.ts +++ b/packages/store-indexer/bin/sqlite-indexer.ts @@ -78,7 +78,7 @@ async function getDistanceFromFollowBlock(): Promise { getLatestStoredBlockNumber(), publicClient.getBlock({ blockTag: env.FOLLOW_BLOCK_TAG }), ]); - return (latestStoredBlockNumber ?? -1n) - latestFollowBlock.number; + return latestFollowBlock.number - (latestStoredBlockNumber ?? -1n); } const currentChainState = await getCurrentChainState(); From ebfe218c8740dded120af91b54cb549361805fa9 Mon Sep 17 00:00:00 2001 From: alvarius Date: Sat, 4 May 2024 01:34:13 +0100 Subject: [PATCH 2/2] Create lazy-rivers-live.md --- .changeset/lazy-rivers-live.md | 5 +++++ 1 file changed, 5 insertions(+) create mode 100644 .changeset/lazy-rivers-live.md diff --git a/.changeset/lazy-rivers-live.md b/.changeset/lazy-rivers-live.md new file mode 100644 index 0000000000..9ad8dbb0ce --- /dev/null +++ b/.changeset/lazy-rivers-live.md @@ -0,0 +1,5 @@ +--- +"@latticexyz/store-indexer": patch +--- + +Fixed the `distance_from_follow_block` gauge to be a positive number if the latest processed block is lagging behind the latest remote block.