Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: Ensure historical invocations are configured correctly #385

Merged
merged 1 commit into from
Nov 13, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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