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

Calculate average processing time as total time / # requests #1152

Merged
merged 1 commit into from
Nov 2, 2023
Merged

Calculate average processing time as total time / # requests #1152

merged 1 commit into from
Nov 2, 2023

Conversation

jadamcrain
Copy link
Contributor

Proposed fix for #1151.

I wasn't crazy about any of the options for dividing a Duration.

The problem w/ checked_div is that it only takes u32 and total_requests is usize.

I considered div_f64, but just doing the calculation as nanos and converting back to a Duration seems fool-proof and panic-free.

Copy link
Member

@Jarema Jarema left a comment

Choose a reason for hiding this comment

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

LGTM!

Thank you for your contribution!

@Jarema Jarema merged commit e0b1e4d into nats-io:main Nov 2, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants