Skip to content

Conversation

@jonilaitinen
Copy link

This adds support for fractional QPS values (QPS is no longer required to be an integer). The sleep time calculation between requests has been changed to use milliseconds. There is a new test using a fractional 1.75 QPS value, the test would fail if the QPS value would be treated as integer.

There's also a small refactoring in the tests to create a new test_request_count function to enable using the same function in all of the query limit tests.

@jonilaitinen
Copy link
Author

Updated the commit to fix a clippy error

Copy link
Owner

@hatoo hatoo left a comment

Choose a reason for hiding this comment

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

Thank you!
I added a review. Others are good.

src/client.rs Outdated
Comment on lines 1110 to 1112
let sleep_ms = i as f64 * 1000f64 / qps;
tokio::time::sleep_until(
(start + i as u32 * std::time::Duration::from_secs(1) / qps as u32).into(),
(start + std::time::Duration::from_millis(sleep_ms as u64)).into(),
Copy link
Owner

Choose a reason for hiding this comment

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

Copy link
Author

Choose a reason for hiding this comment

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

Good idea, I've made the change

This adds support for fractional QPS values (QPS is no longer required to be an integer).
There is a new test using a fractional 1.75 QPS value, the test would fail if the QPS value
would be treated as integer.

There's also a small refactoring in the tests to create a new `test_request_count` function
to enable using the same function in all of the query limit tests.
@hatoo hatoo merged commit 4d75559 into hatoo:master Apr 2, 2025
18 checks passed
@hatoo
Copy link
Owner

hatoo commented Apr 2, 2025

👍

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