Skip to content

Apply per-call maxRetries on top of the client's retry policy - #2

Merged
garretpremo merged 2 commits into
Premo-Cloud:mainfrom
DevChango:fix/per-call-max-retries
Sep 19, 2026
Merged

garretpremo merged 2 commits into
Premo-Cloud:mainfrom
DevChango:fix/per-call-max-retries

Conversation

@DevChango

Copy link
Copy Markdown
Contributor

RequestOptions.maxRetries(n) is documented as "the client's policy with a different retry count", but it uses RetryPolicy.DEFAULT.withMaxRetries(n), so the client's own statuses and backoff are lost for that call. Example: a client that only retries 503, a server returning 500, and maxRetries(2) → 3 requests instead of 1.

Change: RequestOptions now stores maxRetries separately and applies it on top of the call's policy, or the client's if none is set. The old 3-arg constructor is kept, so existing code still compiles.

Test: perCallMaxRetriesKeepsTheRestOfTheClientPolicy. It fails on main and passes with the change; ./gradlew build passes.

DevChango and others added 2 commits September 18, 2026 19:41
RequestOptions.Builder.maxRetries(n) documented itself as "the client's
policy with a different retry count", but it replaced the policy with
RetryPolicy.DEFAULT.withMaxRetries(n). A client configured with custom
retryable statuses or backoff silently fell back to the defaults for that
call, e.g. retrying a 500 with 500 ms backoff when the client only
retries 503 with 1 ms backoff.

RequestOptions now carries the retry count separately and applies it to
the call's retryPolicy when set, otherwise to the client's. This matches
the JavaScript SDK, where partial per-call retry overrides inherit unset
fields from the client. The previous three-argument constructor is kept.
@garretpremo
garretpremo merged commit b787c6e into Premo-Cloud:main Sep 19, 2026
1 check passed
garretpremo added a commit that referenced this pull request Sep 19, 2026
A response missing an answer, an answer field, or answering with a
different type than asked now fails systemOne with a TypeSafeException
instead of reading as zero or surfacing later (#1, #3).
RequestOptions.maxRetries applies on top of the client's policy instead
of replacing it with the default (#2). READMEs point at 0.2.0.
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.

2 participants