Skip to content

Commit

Permalink
added logs
Browse files Browse the repository at this point in the history
  • Loading branch information
crypticmeta committed Aug 31, 2024
1 parent 3fb5f32 commit 102f92f
Showing 1 changed file with 5 additions and 3 deletions.
8 changes: 5 additions & 3 deletions indexer/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -699,6 +699,7 @@ const init = async () => {
const processQueue = async () => {
while (blockQueue.length > 0) {
// const blockData = blockQueue.shift();
console.log(`need to process ${blockQueue.length-1} more times. ID: ${blockQueue.length}`)
console.log(`${blockQueue.length} items in Queue`)
await main_index();
}
Expand Down Expand Up @@ -737,13 +738,14 @@ ws.addEventListener("message", async function incoming({ data }: any) {
// Calculate the number of blocks that need to be processed
const diff = mempool_height - current_height;

// Log the number of blocks that are behind
console.log(`We are ${diff} Blocks Behind`);

// Push the required number of blocks into the blockQueue
new Array(Math.ceil(diff / LIMIT)).fill(1).forEach(() => {
blockQueue.push(data);
});


// Log the number of blocks that are behind
console.log(`We are ${diff} Blocks Behind and number of times it will be processed: ${blockQueue.length}`);
}

// If this is the first block in the queue, start processing
Expand Down

0 comments on commit 102f92f

Please sign in to comment.