Skip to content

Commit

Permalink
fix missing blocks calc
Browse files Browse the repository at this point in the history
  • Loading branch information
igorls committed Nov 17, 2024
1 parent e9a1b72 commit ae1d924
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/api/routes/v2/health/health.ts
Original file line number Diff line number Diff line change
Expand Up @@ -250,8 +250,9 @@ async function checkElastic(fastify: FastifyInstance): Promise<ServiceResponse<E
// Calculate missing blocks
const lastIndexedBlock = indexedBlocks[0];
const totalIndexed = indexedBlocks[1] - 1;
const missingCounter = (lastIndexedBlock - firstIndexedBlock) - totalIndexed;
const missingPct = (missingCounter * 100 / indexedBlocks[1]).toFixed(2) + "%";
const expectedBlocks = lastIndexedBlock - firstIndexedBlock;
const missingCounter = expectedBlocks - totalIndexed;
const missingPct = (missingCounter * 100 / expectedBlocks).toFixed(2) + "%";

// Data Response
const data: ESService = {
Expand Down

0 comments on commit ae1d924

Please sign in to comment.