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

feat(node-core): stage progress decimal places #6974

Merged
merged 1 commit into from
Mar 5, 2024

Conversation

shekhirin
Copy link
Collaborator

@shekhirin shekhirin commented Mar 5, 2024

Blocked by #6973

This formula adjustment prevents the situation when 99.9999% rounds to 100% and confuses the user, because the stage isn't finished yet, but reports the 100% progress

// Calculate percentage with 2 decimal places.
let percentage = 100.0 * self.processed as f64 / self.total as f64;
// Truncate to 2 decimal places, rounding down so that 99.999% becomes 99.99% and not 100%.
Some(format!("{:.2}%", (percentage * 100.0).floor() / 100.0))

@shekhirin shekhirin added C-enhancement New feature or request A-observability Related to tracing, metrics, logs and other observability tools A-cli Related to the reth CLI labels Mar 5, 2024
@shekhirin shekhirin requested a review from mattsse March 5, 2024 17:21
@shekhirin shekhirin requested a review from gakonst as a code owner March 5, 2024 17:21
@shekhirin shekhirin requested a review from joshieDo March 5, 2024 17:21
@shekhirin shekhirin added this pull request to the merge queue Mar 5, 2024
Merged via the queue into main with commit 173c492 Mar 5, 2024
29 checks passed
@shekhirin shekhirin deleted the alexey/stage-progress-decimal-places branch March 5, 2024 19:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
A-cli Related to the reth CLI A-observability Related to tracing, metrics, logs and other observability tools C-enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants