feat(sdk): align create_linear_retry_strategy with create_retry_strategy (parity with JS #652)#484
Merged
Merged
Conversation
yaythomas
requested changes
Jun 18, 2026
Contributor
There was a problem hiding this comment.
please exclude from commit :-)
| return is_retryable_error_message or is_retryable_error_type | ||
|
|
||
|
|
||
| def _finalize_delay_seconds(base_delay: float, jitter_strategy: JitterStrategy) -> int: |
Contributor
There was a problem hiding this comment.
this could move to JitterStrategy and then it's nicely encapsulated in the Jitter object...
# on JitterStrategy
def finalize_delay(self, base_delay: float) -> int:
return max(1, math.ceil(self.apply_jitter(base_delay)))
Signed-off-by: Sai Asish Y <say.apm35@gmail.com>
89528bd to
95c2a80
Compare
Contributor
Author
|
Dropped uv.lock from the branch and moved the finalize step onto the strategy as JitterStrategy.finalize_delay, so both creators now just call config.jitter_strategy.finalize_delay(base_delay). Tests still green. |
yaythomas
approved these changes
Jun 18, 2026
Contributor
|
great contribution, thank you so much @SAY-5! welcome to the repo 😁 |
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.
Closes #483.
What
create_linear_retry_strategynow takes aLinearRetryStrategyConfig(Duration-based) and gainsmax_delaycapping, jitter (defaultFULL), andretryable_errors/retryable_error_typesfiltering, matchingcreate_retry_strategy. The shared jitter, error-resolution/matching, and final delay clamp logic is extracted into module-level helpers used by both helpers so they cannot drift.Why
create_retry_strategywas already config-shaped with those capabilities; the linear helper lagged behind and forced callers to hand-roll a strategy for jitter, a delay cap, or error filtering. This mirrors the JS change in aws/aws-durable-execution-sdk-js#652.Notes
This is a breaking change, as called out in the issue: the signature moves from positional
(max_attempts, initial_delay, increment)to a config object, and a barecreate_linear_retry_strategy()now appliesFULLjitter.RetryPresets.linear()is pinned tojitter=NONEso its documented deterministic 1s-5s delays are preserved.Testing
Updated the existing linear tests to the config API and added coverage for the new
max_delaycap, jitter application, and message/type error filtering.hatch run test:covpasses locally fortests/retries_test.py.