Skip to content

Commit

Permalink
Stats: make sure average_entry_size doesn't divide by zero
Browse files Browse the repository at this point in the history
  • Loading branch information
tomerfiliba committed Aug 22, 2024
1 parent 25c839c commit 7c9c51a
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion src/store.rs
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ impl Stats {

/// compute the average entry size
pub fn average_entry_size(&self) -> usize {
self.data_bytes() / self.len()
self.data_bytes().checked_div(self.len()).unwrap_or(0)
}

/// total bytes consumed by the store (including headers and wasted bytes)
Expand Down

0 comments on commit 7c9c51a

Please sign in to comment.