Skip to content

Commit

Permalink
only update non empty chunks offset
Browse files Browse the repository at this point in the history
  • Loading branch information
brokkoli71 committed Aug 20, 2024
1 parent 014f19b commit 5927e38
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion zarrita/sharding.py
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,8 @@ async def finalize(
) -> BytesLike:
index_bytes = await index_encoder(self.index)
if index_location == ShardingCodecIndexLocation.start:
self.index.offsets_and_lengths[..., 0] += len(index_bytes)
empty_chunks_mask = self.index.offsets_and_lengths[..., 0] == MAX_UINT_64
self.index.offsets_and_lengths[~empty_chunks_mask, 0] += len(index_bytes)
index_bytes = await index_encoder(
self.index
) # encode again with corrected offsets
Expand Down

0 comments on commit 5927e38

Please sign in to comment.