Skip to content

Commit

Permalink
olah cache read_block bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jstzwj committed Feb 24, 2025
1 parent 6637ab1 commit a4b0af0
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions src/olah/cache/olah_cache.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,7 +262,10 @@ def read_block(self, block_index: int) -> Optional[bytes]:
if not self.has_block(block_index=block_index):
return None

offset = self._get_header_size() + (block_index * self._get_block_size())
with open(self.path, "rb") as f:
f.seek(offset, 0)
raw_block = f.read(self._get_block_size())
# Prefetch blocks
for block_offset in range(1, self._prefech_blocks + 1):
if block_index + block_offset >= self._get_block_number():
Expand Down

0 comments on commit a4b0af0

Please sign in to comment.