Skip to content

Commit

Permalink
more yielding
Browse files Browse the repository at this point in the history
  • Loading branch information
arpad-m committed Jun 6, 2024
1 parent 2fdfcab commit 4ad2aad
Showing 1 changed file with 5 additions and 0 deletions.
5 changes: 5 additions & 0 deletions pageserver/src/tenant/storage_layer/image_layer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -440,11 +440,16 @@ impl ImageLayer {
.await?;

let cursor = block_reader.block_cursor();
let mut counter = 0u32;
while let Some(r) = key_offset_stream.next().await {
let (key, offset) = r?;
let key = Key::from_slice(&key);
let content = cursor.read_blob(offset, ctx).await?;
writer.put_image(key, content.into(), ctx).await?;
counter += 1;
if counter % 2048 == 0 {
tokio::task::yield_now().await;
}
}
Ok(writer.size())
}
Expand Down

0 comments on commit 4ad2aad

Please sign in to comment.