Skip to content

[Rest] Clamp non-finite Retry-After values#1615

Open
star7js wants to merge 1 commit intoatlassian-api:masterfrom
star7js:fix/retry-after-clamp
Open

[Rest] Clamp non-finite Retry-After values#1615
star7js wants to merge 1 commit intoatlassian-api:masterfrom
star7js:fix/retry-after-clamp

Conversation

@star7js
Copy link

@star7js star7js commented Feb 7, 2026

Summary

  • Add unit test for non-finite Retry-After handling.
  • Clamp non-finite Retry-After values (e.g., 1e309inf) to max_backoff_seconds.

What Goes Wrong Today

  • The library parses Retry-After as a number.
  • Extremely large values can become inf, which can break or cause unrealistic sleep behavior.

What The Fix Does

  • After parsing, checks whether the value is finite.
  • If not finite, clamps it to max_backoff_seconds.
  • Uses the safe value for time.sleep.

Why This Is Safe

  • The library already clamps large finite values to max_backoff_seconds.
  • inf is just “beyond large”; clamping keeps behavior consistent.
  • Preserves intended semantics: wait, but not forever.

Tests

  • pytest -q tests/test_rest_client.py -k "retry_handler"

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.

1 participant