Skip to content

Commit

Permalink
fix: Ensure historical invocations are configured correctly
Browse files Browse the repository at this point in the history
  • Loading branch information
morgsmccauley committed Nov 13, 2023
1 parent 530efd3 commit bc975ea
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions runner/src/stream-handler/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -105,21 +105,22 @@ async function blockQueueConsumer (workerContext: WorkerContext, streamKey: stri
const startTime = performance.now();
const blockStartTime = startTime;
const block = queueMessage.block;
const isHistorical = workerContext.streamType === 'historical';
streamMessageId = queueMessage.streamMessageId;

if (block === undefined || block.blockHeight == null) {
console.error('Block failed to process or does not have block height', block);
continue;
}
METRICS.BLOCK_WAIT_DURATION.labels({ indexer: indexerName, type: workerContext.streamType }).set(performance.now() - blockStartTime);
await indexer.runFunctions(block, functions, false, { provision: true });
await indexer.runFunctions(block, functions, isHistorical, { provision: true });

await workerContext.redisClient.deleteStreamMessage(streamKey, streamMessageId);
await workerContext.queue.shift();

METRICS.EXECUTION_DURATION.labels({ indexer: indexerName, type: workerContext.streamType }).observe(performance.now() - startTime);

if (workerContext.streamType === 'historical') {
if (isHistorical) {
METRICS.LAST_PROCESSED_BLOCK_HEIGHT.labels({ indexer: indexerName, type: workerContext.streamType }).set(block.blockHeight);
}

Expand Down

0 comments on commit bc975ea

Please sign in to comment.