Skip to content

Fix retrypolicy bug, see issue #646 #647

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

Merged
merged 1 commit into from
Aug 8, 2018
Merged

Conversation

zoewangg
Copy link
Contributor

@zoewangg zoewangg commented Aug 3, 2018

AndRetryCondition(conditions=[MaxNumberOfRetriesCondition(maxNumberOfRetries=3), MaxNumberOfRetriesCondition(maxNumberOfRetries=0)])

and it should be

MaxNumberOfRetriesCondition(maxNumberOfRetries=0)
  • added more tests.

@zoewangg zoewangg changed the title Fix retrypolicy bug, see issue #645 Fix retrypolicy bug, see issue #646 Aug 3, 2018
@@ -54,7 +55,12 @@ private RetryPolicy(BuilderImpl builder) {
this.throttlingBackoffStrategy = builder.throttlingBackoffStrategy;
this.numRetries = builder.numRetries;
this.retryConditionFromBuilder = builder.retryCondition;
this.retryCondition = AndRetryCondition.create(MaxNumberOfRetriesCondition.create(numRetries), retryConditionFromBuilder);
if (numRetries == 0) {
Copy link
Contributor

Choose a reason for hiding this comment

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

Hmm why do we do this?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

RetryCondition.none() would be MaxNumberOfRetriesCondition(maxNumberOfRetries=0)
If we don't add the check here, it will add another duplicate condition MaxNumberOfRetriesCondition(maxNumberOfRetries=0)

RetryPolicy.none() would resolve to

AndRetryCondition(conditions=[MaxNumberOfRetriesCondition(maxNumberOfRetries=0), MaxNumberOfRetriesCondition(maxNumberOfRetries=0)])

Alternately, we can update AndRetryCondition to a Set instead of a list to fix this.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

hmm, seems like it will introduce another bug.
RetryPolicy.builder().numRetris(0).build() would still retry in this case.

I'll update the PR and use Set in AndReryCondition instead

@zoewangg zoewangg force-pushed the zoewang-retryPolicyfix branch from 487b2f7 to c34d885 Compare August 8, 2018 17:04
@zoewangg zoewangg merged commit 1a9461a into master Aug 8, 2018
@zoewangg zoewangg deleted the zoewang-retryPolicyfix branch August 8, 2018 18:04
aws-sdk-java-automation added a commit that referenced this pull request Oct 22, 2019
…017c41d5

Pull request: release <- staging/64ec41fe-a5f3-445a-83ca-6315017c41d5
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.

RetryPolicy Builder does not have throttlingBackoffStrategy method
3 participants