Skip to content
This repository has been archived by the owner on Jun 21, 2023. It is now read-only.

Add retryOnReturnValues and retryOnReturnValuesExcluding #79

Merged

Conversation

ruhan1
Copy link
Contributor

@ruhan1 ruhan1 commented Jan 8, 2019

I need two more APIs in RetryConfigBuilder. The retryOnReturnValues takes an array of retriable values. The retryOnReturnValuesExcluding handles the case where I only expect certain return value(s). E.g., only "200" for a REST call and retry for any other status codes.
Can anyone help review this?

@coveralls
Copy link

coveralls commented Jan 8, 2019

Pull Request Test Coverage Report for Build 345

  • 30 of 30 (100.0%) changed or added relevant lines in 3 files are covered.
  • No unchanged relevant lines lost coverage.
  • Overall coverage increased (+0.2%) to 97.028%

Totals Coverage Status
Change from base Build 342: 0.2%
Covered Lines: 457
Relevant Lines: 471

💛 - Coveralls

Copy link
Owner

@elennick elennick left a comment

Choose a reason for hiding this comment

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

sorry for the delay... left some feedback

@@ -153,6 +154,32 @@ private void postExecutionCleanup(Callable<T> callable, int maxTries, AttemptSta
return attemptStatus;
}

private boolean isOneOfValuesToExpect( T callResult ) {
Object[] valuesToExpect = config.getValuesToExpect();
Copy link
Owner

Choose a reason for hiding this comment

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

could you format these blocks to be consistent with code styling in the rest of the class? eg: less whitespace and line breaks

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Updated.


@SafeVarargs
public final RetryConfigBuilder retryOnReturnValues(Object... values) {
retryOnValue = true;
Copy link
Owner

Choose a reason for hiding this comment

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

i would generally prefer wrapping these with a Collection of some sort rather than storing them as a raw array... for example: https://github.com/elennick/retry4j/pull/79/files#diff-25b653eb79d0323ac9625faf0ae65ef9R101

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Fair enough. Updated.

@ruhan1
Copy link
Contributor Author

ruhan1 commented Feb 11, 2019

Thanks for the review and I updated accordingly.

@elennick elennick merged commit 1ff4fa4 into elennick:master Mar 7, 2019
@elennick
Copy link
Owner

elennick commented Mar 7, 2019

@ruhan1 any chance you wouldn't mind updating the README as well to reflect the new API's you added?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants