fix(scala): pass retry count to retryUntil delay function#6645
Merged
Conversation
Contributor
No code generatedIf you believe code should've been generated, please, report the issue. 📊 Benchmark resultsBenchmarks performed on the method using a mock server, the results might not reflect the real-world performance.
|
Fluf22
approved these changes
Jul 3, 2026
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.
🧭 What and Why
🎟 JIRA Ticket: API-422
RetryUntil.retryUntilpassed the current delay value back into thedelayfunction instead of the retry count. Because the seed isdelay(0) = 0and the delay functions are multiplicative (e.g.retries * 200), the result collapsed to0and fed itself0on every subsequent retry — so no backoff ever happened and polling hammered the API with zero delay.The parameter was already named
retriesand every caller treats it as a retry count, so this was purely a wiring bug: the input's intended meaning ("retry count") never matched what was passed in ("current delay").Changes included:
retryCounttodelay(...)instead of the accumulatedcurrentDelay.currentDelayaccumulator and thedelay(0)seed from the internalattempthelper.attemptis a local nested function, so this is not a public API change — theretryUntilsignature andDEFAULT_DELAY: Long => Longare unchanged, and no call sites needed edits.Resulting backoff now ramps as intended:
DEFAULT_DELAY(retries * 200, cap 5000)0, 0, 0, …0, 200, 400, …, 5000mspollEvent(retries * 1500, cap 5000)0, 0, 0, …0, 1500, 3000, 5000ms🧪 Test
yarn cli cts run scalapasses. Note that CTS asserts polling correctness, not timing — the bug never broke correctness (it still polled, just with no delay), so CTS is a regression guard here rather than a direct validation of the backoff fix.Found during review of #6312 (feat(scala): add withTransformation helpers).