Skip to content

Avoid unnecessary exponential wait computation#654

Merged
mergify[bot] merged 1 commit into
jd:mainfrom
Sanjays2402:fix/avoid-exponential-overflow
Jul 13, 2026
Merged

Avoid unnecessary exponential wait computation#654
mergify[bot] merged 1 commit into
jd:mainfrom
Sanjays2402:fix/avoid-exponential-overflow

Conversation

@Sanjays2402

Copy link
Copy Markdown
Contributor

wait_exponential(max=...) still computes exp_base ** attempt_number on every retry after reaching the cap, making each later retry increasingly expensive during long-running polling. This checks the logarithmic threshold first and returns the configured cap without constructing the large integer; the regression test proves the power operation is skipped.

Fixes #526.

Once an exponential wait exceeds its configured maximum, calculate the
threshold logarithmically and return the cap without constructing an ever
larger integer power. Add a regression test that rejects power evaluation
past the cap.

Fixes jd#526
@mergify

mergify Bot commented Jul 13, 2026

Copy link
Copy Markdown
Contributor

Merge Queue Status

  • Entered queue2026-07-13 08:54 UTC · Rule: default · triggered by rule autoqueue
  • Checks skipped · PR is already up-to-date
  • Merged2026-07-13 08:54 UTC · at 91b1cf8befd87e1e4b12fd5c6041a961d6cbe17a · squash

This pull request spent 13 seconds in the queue, including 1 second running CI.

Required conditions to merge

@mergify
mergify Bot merged commit 29d398b into jd:main Jul 13, 2026
9 checks passed
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.

exponential wait issue

2 participants