Fix HttpStore write retries using the read endpoint's config#1751
Open
durvesh1992 wants to merge 1 commit into
Open
Fix HttpStore write retries using the read endpoint's config#1751durvesh1992 wants to merge 1 commit into
durvesh1992 wants to merge 1 commit into
Conversation
HttpStore.#withRetries takes an `endpoint` parameter (get() passes
#getEndpoint, set() passes #setEndpoint) and correctly consults it for
the maxAttempts===1 short-circuit. But the backOff options hardcoded
this.#getEndpoint for numOfAttempts, retryStatuses, and
retryNetworkErrors. When the store is constructed with the documented
split { getOptions, setOptions } form, all set()/PUT retries silently
used the read endpoint's retry configuration (e.g. setOptions.maxAttempts
and setOptions.retryStatuses were ignored).
Use the passed-in `endpoint` consistently. Adds a regression test
exercising the split form on set() (the existing retry tests only use the
single-options form via get(), where the two endpoints are identical).
Contributor
|
@robhogan has imported this pull request. If you are a Meta employee, you can view this in D109932333. |
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.
Summary
HttpStore.#withRetries(fn, endpoint)is called for both endpoints —get()passes#getEndpoint,set()passes#setEndpoint— and it correctly consults the passedendpointfor themaxAttempts === 1short-circuit. However, thebackOffoptions hardcodedthis.#getEndpointfornumOfAttempts,retryStatuses, andretryNetworkErrors.As a result, when an
HttpStoreis constructed with the documented split{ getOptions, setOptions }form, allset()/PUT retries silently use the read endpoint's retry configuration —setOptions.maxAttempts,setOptions.retryStatuses, andsetOptions.retryNetworkErrorsare ignored. There's also an internal inconsistency: themaxAttempts === 1early-return reads the (set) endpoint, butnumOfAttemptsthen read#getEndpoint.maxAttempts.The fix uses the passed-in
endpointconsistently.Test plan
The existing retry tests only use the single-options form via
get(), where#getEndpoint === #setEndpoint, so they can't catch this. Added a regression test that builds the store with the split form (reads:maxAttempts: 1; writes:maxAttempts: 2, retryStatuses: [503]) and assertsset()retries a 503:set()uses the read config (no retry) and throws the 503 → test fails.set()retries persetOptionsand resolves → test passes.