{{ message }}
Repository navigation
Fix pretty_size and pretty_duration right below a unit boundary - #8498
Open
qodelicious wants to merge 2 commits into
Open
qodelicious wants to merge 2 commits into
qodelicious wants to merge 2 commits into
Conversation
This branch has not been deployed
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.

Description
pretty_sizeandpretty_durationpick the unit before rounding, so values just under a boundary come out in the wrong unit once they're formatted.pretty_size(1024 * 1024 - 1)gives1024kinstead of1.0mpretty_duration(0.9996)gives1000msinstead of1.00spretty_duration(9.996)gives10.00sinstead of10.0spretty_duration(99.96)gives100.0sinstead of100sThese show up in the console flow list and in the dumper output. The fix compares the rounded value against the limit, so the unit and precision match what actually gets printed. I also swept a few million sizes and durations around the boundaries to make sure none of the odd outputs are left and
pretty_sizestill stays at 5 characters or less.Checklist