Repository navigation
fix(client): retry policies and client options refuse values that would fail later - #121
Merged
kalaspuff merged 1 commit intoOct 31, 2026
Conversation
…ld fail later RetryPolicy validated timedelta delays but kept them unconverted, so base_delay=timedelta(...) raised TypeError and two timedelta delays made every client using the policy fail to connect. It now stores float seconds. max_attempts, batch_concurrency, batch_max_rounds and event_buffer accepted floats, bools and strings that failed at the first call: they must be ints now, and retry= a RetryPolicy. Durations past what Duration and Instant arithmetic hold (timeout=1e20, base_delay=1e300, wait_until_active(timeout=1e19)) panicked in the core; the core caps durations at about 31 years, which means no limit. wait_until_active() and wait_until_deleted() take a timedelta too. Fixes #89 Co-authored-by: Carl Oscar Aaro <[email protected]>
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
Several client options passed validation and then failed later, at connect or at the first call:
RetryPolicy(base_delay=timedelta(milliseconds=10))raisedTypeError('<' not supported), and with both delays astimedeltathe policy constructed but every client using it failed to connect withConfigurationError: must be real number, not datetime.timedelta, althoughdocs/reference/configuration.mdsays durations accepttimedelta. The policy validated the durations but kept them unconverted; it now stores float seconds.RetryPolicy(max_attempts=2.5),Client(batch_concurrency=2.5)and counts given asboolorstrpassed construction and failed at the first call.max_attempts,batch_concurrency,batch_max_roundsandevent_buffermust now beints of at most 4,294,967,295 (the core's counts are 32-bit), andClient(retry=...)aRetryPolicy, or the constructor raisesTypeError(ValueErrorfor a value out of range, with the messages as before).timeout=1e20,RetryPolicy(base_delay=1e300, max_delay=1e300),wait_until_active(timeout=1e19)) raisedDynamoxyError: internal error: a dynamoxy task panicked:Duration::from_secs_f64panics above about 1.8e19 seconds andInstant + timeoutoverflows. The core now caps durations at 1e9 seconds (about 31 years), which means no limit in practice, for the request and connect timeouts, retry delays and table waits.wait_until_active()andwait_until_deleted()now also take atimedelta, like the other durations, and refuse a negative timeout before any request.Verified with unit tests of the policy and client validation and of the capped durations (Rust and Python, including a memory client with all of these huge values that creates a table, waits for it and reads), which fail without the fix.
make checkpasses.Fixes #89
Checklist
make checkpasses locally (lint, types, clippy, consistency, tests)Worth confirming
timeout=1e20means "no limit" instead of raising; the issue allowed either. Counts above 2**32 - 1 are refused, since the core cannot hold them.RetryPolicy.base_delayandmax_delayread back as float seconds when given astimedelta(they are typedfloat | timedelta).fctl session
Note
Low risk. It tightens validation of client options and caps huge durations in the core, so it only changes behavior for values that already failed at connect or at the first call; the one rejection that could affect working code is non-
intcounts such as numpy integers.What it does. Fixes client options that passed construction and then failed later.
RetryPolicynow convertstimedeltadelays to float seconds, so atimedeltabase_delayno longer raisesTypeErrorand a policy with twotimedeltadelays no longer breaks connecting.max_attempts,batch_concurrency,batch_max_roundsandevent_buffermust now beints up to 4,294,967,295, andClient(retry=...)must be aRetryPolicy. The core caps durations at 1e9 seconds, sotimeout=1e20orbase_delay=1e300mean no limit instead of panicking, andwait_until_active()andwait_until_deleted()take atimedeltaand refuse a negative timeout.Stricter option types. Counts given as
float,boolorstrnow raiseTypeErrorwhen the client or policy is created, instead of failing at the first call; durations above about 31 years are capped rather than refused.fctl review's first look at
dab90e0· 11 files, +169 −40 · Review agent settings