jira icon indicating copy to clipboard operation
jira copied to clipboard

Improve handling of Jira's retry-after handling

Open matthias-bach-by opened this issue 1 year ago • 2 comments

As reported in #1805, while 3.6.0 brought a beneficial change in evaluating Jira's retry-after header, in some scenarios it actually degraded the success rate of requests when hitting rate-limits due to two issues:

  1. Jira intends the retry-after header to be a minimum backoff but the code treats it as a maximum backoff, and
  2. Jira sometimes sends a retry-after value of 0 seconds which the existing code implicitly treated as a failed request.

To address this, this PR changes the back-off behaviour to treat the retry-after time as a minimum backoff, at least as long as our maximum back-off time does allow this, and clips the retry-after header, if specified, to a minimum of one second.

I have extended the existing tests for the retry logic to assert this behaviour. If you would prefer a separate set of tests or see other changes to the approach, let me know and I'll adjust the PR.

matthias-bach-by avatar Feb 26 '24 16:02 matthias-bach-by

The cloud tests are failing in set-up and this seems to be a wider issue unrelated to my changes as I am also seeing that on other PRs. Happy to rebase once that is fixed on main.

matthias-bach-by avatar Feb 27 '24 10:02 matthias-bach-by

Thanks for the excellent PR and sorry for the delay in getting in merged and released!

adehad avatar Mar 21 '24 13:03 adehad