diff options
Diffstat (limited to 'tvix/castore')
-rw-r--r-- | tvix/castore/src/blobservice/chunked_reader.rs | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/tvix/castore/src/blobservice/chunked_reader.rs b/tvix/castore/src/blobservice/chunked_reader.rs index e193ff0295db..2aaea385aed2 100644 --- a/tvix/castore/src/blobservice/chunked_reader.rs +++ b/tvix/castore/src/blobservice/chunked_reader.rs @@ -209,8 +209,8 @@ where let blob_service = self.blob_service.clone(); let chunks: Vec<_> = self.chunks[start_chunk_idx..].to_vec(); - let readers_stream = tokio_stream::iter(chunks).map( - move |(_chunk_start_offset, _chunk_size, chunk_digest)| { + let readers_stream = tokio_stream::iter(chunks.into_iter().enumerate()).map( + move |(nth_chunk, (_chunk_start_offset, _chunk_size, chunk_digest))| { let chunk_digest = chunk_digest.to_owned(); let blob_service = blob_service.clone(); async move { @@ -223,7 +223,8 @@ where std::io::Error::new(std::io::ErrorKind::NotFound, "chunk not found") })?; - if skip_first_chunk_bytes > 0 { + // iff this is the first chunk in the stream, skip by skip_first_chunk_bytes + if nth_chunk == 0 && skip_first_chunk_bytes > 0 { blob_reader .seek(std::io::SeekFrom::Start(skip_first_chunk_bytes as u64)) .await?; |