Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prevent retry logic modifications through the builder #2031

Merged
merged 1 commit into from
Dec 21, 2021

Conversation

idelpivnitskiy
Copy link
Member

Motivation:

The final retry predicate depends on class variables of the builder in
RetryingHttpRequesterFilter. User can keep a reference to the builder
and modify functions to change the retry behavior in runtime.

Modifications:

  • Capture the context of the builder state in final variables to
    eliminate any runtime behavior change in RetryingHttpRequesterFilter;

Result:

RetryingHttpRequesterFilter behavior can not be altered through the
builder at runtime.

Motivation:

The final retry predicate depends on class variables of the builder in
`RetryingHttpRequesterFilter`. User can keep a reference to the builder
and modify functions to change the retry behavior in runtime.

Modifications:

- Capture the context of the builder state in `final` variables to
eliminate any runtime behavior change in `RetryingHttpRequesterFilter`;

Result:

`RetryingHttpRequesterFilter` behavior can not be altered through the
builder at runtime.
@idelpivnitskiy idelpivnitskiy self-assigned this Dec 20, 2021
@idelpivnitskiy idelpivnitskiy added the bug Something isn't working label Dec 20, 2021
@@ -705,6 +705,16 @@ public Builder retryOther(
* @return A new retrying {@link RetryingHttpRequesterFilter}
*/
public RetryingHttpRequesterFilter build() {
final BiFunction<HttpRequestMetaData, RetryableException, BackOffPolicy> retryRetryableExceptions =
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice!

@idelpivnitskiy idelpivnitskiy merged commit dc2868a into apple:main Dec 21, 2021
@idelpivnitskiy idelpivnitskiy deleted the fix-retry branch December 21, 2021 00:10
idelpivnitskiy added a commit that referenced this pull request Dec 21, 2021
Motivation:

The final retry predicate depends on class variables of the builder in
`RetryingHttpRequesterFilter`. User can keep a reference to the builder
and modify functions to change the retry behavior in runtime.

Modifications:

- Capture the context of the builder state in `final` variables to
eliminate any runtime behavior change in `RetryingHttpRequesterFilter`;

Result:

`RetryingHttpRequesterFilter` behavior can not be altered through the
builder at runtime.
bondolo pushed a commit that referenced this pull request Dec 21, 2021
Motivation:

The final retry predicate depends on class variables of the builder in
`RetryingHttpRequesterFilter`. User can keep a reference to the builder
and modify functions to change the retry behavior in runtime.

Modifications:

- Capture the context of the builder state in `final` variables to
eliminate any runtime behavior change in `RetryingHttpRequesterFilter`;

Result:

`RetryingHttpRequesterFilter` behavior can not be altered through the
builder at runtime.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants