Repository navigation
Conversation
`payments list --watch` waited the server's `Retry-After` in place of its own pause. `retry_after()` returns zero for `Retry-After: 0`, `x-retry-after-ms: 0`, or an HTTP date already past, which clock skew can produce, so a 429 or 5xx carrying such a hint was retried at once, again and again, for as long as the server answered that way. On a refresh that worked, the same hint could make the watch poll faster than `--interval`. `watch::pause` takes the longer of the hint and the watch's own pause: `--interval` after a refresh that worked, the backoff after a failure. Retry-After is the least time the server asks for, so it can lengthen a pause but never shorten it. The backoff now advances on every failure, also one with a hint, so repeated rate limits wait longer; a success still resets it.
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.
Problem
payments list --watch(#111) waited the server'sRetry-Afterin place of its own pause.retry_after()returns zero forRetry-After: 0,x-retry-after-ms: 0, or an HTTP date already past, which clock skew can produce. So a 429 or 5xx carrying such a hint was retried at once, again and again, for as long as the server answered that way. On a refresh that worked, the same hint could make the watch poll faster than--interval. I raised this as a nonblocking note on #111, which merged before it was addressed.Change
watch::pausetakes the longer of the hint and the watch's own pause.Retry-Afteris the least time the server asks for, so it can lengthen a pause but never shorten it.--interval--interval--intervalThe backoff now advances on every failure, also one with a hint, so repeated rate limits wait longer, up to the 60-second ceiling. A refresh that works still resets it. The payments guide and the unreleased
--watchchangelog entry say the same.Validation
In
nix develop:cargo fmt --check,cargo clippy --locked --all-targets -- -D warnings,cargo machete --with-metadata,cargo test --locked(198 unit, 150 integration) andpython3 scripts/check-coverage.pypassed.a_retry_hint_lengthens_a_pause_but_never_shortens_itcovers no hint, a zero hint, a shorter hint and a longer hint.a_watch_never_refreshes_sooner_than_its_own_pause_for_a_zero_retry_hintsendsRetry-After: 0on a success and on a 429, then a 403 that ends the watch, with--interval 1. It asserts that at least 2.5 seconds passed. That is a lower bound, so it cannot flake by finishing early. With the old code the watch finished in 1.05 seconds, and the test failed.CRAP report: 843 measured functions, none at or above 20. The highest is
wait_for_paymentat 18.10, which this change does not touch. The first CRAP run failed on the two pseudo-terminal login tests that #104 addresses (a_quiet_login_on_a_terminal_still_shows_the_code_but_no_closing_lineanda_profile_saved_after_login_keeps_changes_made_while_its_prompt_was_open). The rerun passed.