Skip to content

Commit

Permalink
fix: Do not eat bitmap backfill errors (#871)
Browse files Browse the repository at this point in the history
If the stream yielding block heights from the bitmap indexer fails, its
error will be eaten by the while loop as the loop will simply end if any
error takes place. This PR ensures that if the result from the stream is
an error, it logs the error before proceeding with Lake.
  • Loading branch information
darunrs authored Jul 16, 2024
1 parent 0870f25 commit d25763d
Showing 1 changed file with 20 additions and 9 deletions.
29 changes: 20 additions & 9 deletions block-streamer/src/block_stream.rs
Original file line number Diff line number Diff line change
Expand Up @@ -269,15 +269,26 @@ async fn process_bitmap_indexer_blocks(

let mut last_published_block_height: u64 = start_block_height;

while let Some(Ok(block_height)) = matching_block_heights.next().await {
redis
.publish_block(indexer, redis_stream.clone(), block_height, MAX_STREAM_SIZE)
.await?;
redis
.set_last_processed_block(indexer, block_height)
.await?;

last_published_block_height = block_height;
while let Some(block_height_result) = matching_block_heights.next().await {
match block_height_result {
Ok(block_height) => {
redis
.publish_block(indexer, redis_stream.clone(), block_height, MAX_STREAM_SIZE)
.await?;
redis
.set_last_processed_block(indexer, block_height)
.await?;

last_published_block_height = block_height;
}
Err(err) => {
tracing::error!(
"Backfill using bitmap indexer failed unexpectedly: {:?}",
err
);
break;
}
}
}

Ok(last_published_block_height)
Expand Down

0 comments on commit d25763d

Please sign in to comment.