fix(throughput): use fractional lookback divisor#78
Merged
Conversation
Merged
shikhar
pushed a commit
that referenced
this pull request
Feb 19, 2026
## 🤖 New release * `cachey`: 0.10.0 -> 0.10.1 <details><summary><i><b>Changelog</b></i></summary><p> <blockquote> ## [0.10.1](0.10.0...0.10.1) - 2026-02-19 ### Fixed - *(throughput)* use fractional lookback divisor ([#78](#78)) - *(object_store)* prioritize client-ordered buckets and correct decay ([#76](#76)) </blockquote> </p></details> --- This PR was generated with [release-plz](https://github.com/release-plz/release-plz/). Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Greptile SummaryFixes throughput overestimation by using fractional seconds for the divisor in
The fix prevents scenarios where a 1.5-second lookback would incorrectly divide by 1.0 instead of 1.5, causing 50% throughput overestimation. Confidence Score: 5/5
Important Files Changed
Flowchart%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[bps called with lookback Duration] --> B{lookback == 0 or NUM_BUCKETS == 0?}
B -->|Yes| C[Return 0.0]
B -->|No| D[Calculate lookback_seconds_f64 = max lookback.as_secs_f64, 1.0]
D --> E[Calculate lookback_secs = max lookback.as_secs, 1]
E --> F[Advance to current tick]
F --> G[Calculate window_secs = min lookback_secs, NUM_BUCKETS]
G --> H{window_secs == 0?}
H -->|Yes| C
H -->|No| I[Sum bytes from window_secs completed buckets]
I --> J[Return sum / lookback_seconds_f64]
style D fill:#90EE90
style J fill:#90EE90
Last reviewed commit: be4eeb7 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Testing
Closes #72