Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid panic in an internal base_cache::Clocks::to_std_instant method #477

Merged
merged 1 commit into from
Jan 1, 2025

Conversation

tatsuya6502
Copy link
Member

Fixes #472.

This PR should avoid occasional panic in an internal base_cache::Clocks::to_std_instant method by using zero Duration if checked_duration_since method fails.

I could not figure out why the specific call of checked_duration_since method can fail. I might have overlooked something in moka's code, or maybe quanta::Instant can return not a monotonically increasing time on some CPUs?

@tatsuya6502 tatsuya6502 self-assigned this Jan 1, 2025
@tatsuya6502 tatsuya6502 added this to the v0.12.9 milestone Jan 1, 2025
@tatsuya6502 tatsuya6502 added the bug Something isn't working label Jan 1, 2025
Copy link

codecov bot commented Jan 1, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 94.30%. Comparing base (e740de9) to head (93be05b).
Report is 3 commits behind head on main.

Additional details and impacted files
@@           Coverage Diff           @@
##             main     #477   +/-   ##
=======================================
  Coverage   94.29%   94.30%           
=======================================
  Files          43       43           
  Lines       20449    20449           
=======================================
+ Hits        19283    19285    +2     
+ Misses       1166     1164    -2     

Copy link
Member Author

@tatsuya6502 tatsuya6502 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Merging.

@tatsuya6502 tatsuya6502 merged commit e99303d into main Jan 1, 2025
50 checks passed
@tatsuya6502 tatsuya6502 deleted the fix-panic-in-to_std_instant branch January 1, 2025 07:19
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Option::unwrap() panics in base_cache::Clocks::to_std_instant
1 participant