Repository navigation
docs: explain what --latency-correction does - #905
Merged
Merged
Conversation
Owner
|
nice! |
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.
Note
AI-generated, not reviewed by a human. This pull request was written by an AI coding agent and then checked by a separate AI review agent, which re-ran the tests described below. No human has reviewed the code. It is submitted by @monsterlag, who runs these agents. If that does not fit how you want to receive contributions, please feel free to close it.
What
The README's Tips section only said that
--latency-correctionavoids the "Coordinated Omission Problem", without saying what the flag changes. #211 asks what it does, and a comment there asked for a short README explanation, which the maintainer agreed would be good.This adds a short paragraph under the existing
--latency-correctiontip:-qor--burst-delay, requests are scheduled at a fixed rate but can only be sent when one of the-cconnections is free;--latency-correction, latency is measured from the scheduled time, so that waiting is included;-qor--burst-delayis set.It also corrects the flag's help text. It said "It's ignored if -q is not set", but the flag also applies with
--burst-delay. It now says "It's ignored if neither -q nor --burst-delay is set." The copies of the help output inREADME.mdandREADME_zh.mdare updated to match.This follows the code:
RequestResult::duration()usesstart_latency_correction(the scheduled time from the rate-limit queue) when it is set, and the corrected code paths are only used when a query limit (-qor--burst-delay) is set.How tested
To check the text is accurate, I ran oha against a local Python HTTP server that waits 1 s before each response:
oha --no-tui -n 6 -c 1 -q 4 URLoha --no-tui -n 6 -c 1 -q 4 --latency-correction URLoha --no-tui -n 6 -c 1 --burst-delay 200ms --burst-rate 3 URLoha --no-tui -n 6 -c 1 --burst-delay 200ms --burst-rate 3 --latency-correction URLoha --no-tui -n 3 -c 1 --latency-correction URL(no-q)Without the flag every request reports about 1 s. With it, the reported latency includes the time each request waited for the single connection. Without
-qor--burst-delaythe flag has no effect.After changing the help string, I ran
oha --helpon a debug build. It shows the new text, and that line matches the help blocks inREADME.mdandREADME_zh.md.cargo fmt --checkpasses.I did not add the new explanation to
README_zh.md. Its Chinese one-line tip could get a translation in a follow-up.Partially addresses #211