Skip to content

Commit

Permalink
add another check for pending blocks
Browse files Browse the repository at this point in the history
  • Loading branch information
moodysalem committed Oct 29, 2024
1 parent 084fae4 commit 91b6f08
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ const refreshAnalyticalTables = throttle(

await dao.beginTransaction();

let isPending: boolean = true;
let isPending: boolean = false;

let deletedCount: number = 0;

Expand All @@ -131,7 +131,11 @@ const refreshAnalyticalTables = throttle(

// for pending blocks we update operational materialized views before we commit
isPending =
isPending || FieldElement.toBigInt(block.header.blockHash) === 0n;
isPending ||
FieldElement.toBigInt(block.header.blockHash) === 0n ||
// blocks in the last 5 minutes are considered pending
parseLong(block.header.timestamp.seconds) >
Date.now() / 1000 - 300;

const blockTime = new Date(
Number(parseLong(block.header.timestamp.seconds) * 1000n)
Expand Down

0 comments on commit 91b6f08

Please sign in to comment.