-
Notifications
You must be signed in to change notification settings - Fork 7.6k
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
2.x: Add retry(times, predicate) to Single & Completable and verify behavior across them and Maybe. #5753
Conversation
…ehavior across them and Maybe.
Given you've added this to the 2.2 milestone should I update the |
There is going to be a couple of 2.1.x till then. I don't want to release 2.2.0 until the marbles get fixed. |
Codecov Report
@@ Coverage Diff @@
## 2.x #5753 +/- ##
============================================
- Coverage 96.32% 96.28% -0.04%
+ Complexity 5842 5840 -2
============================================
Files 634 634
Lines 41650 41653 +3
Branches 5769 5769
============================================
- Hits 40120 40107 -13
- Misses 600 617 +17
+ Partials 930 929 -1
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pls check actual number of retries in tests, otherwise LGTM :)
@@ -1545,6 +1545,28 @@ public final Completable retry(long times) { | |||
return fromPublisher(toFlowable().retry(times)); | |||
} | |||
|
|||
/** | |||
* Returns a Completable that when this Completable emits an error, retries at most times |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
nit: Phrasing seems a little bit off here, something like "Returns a Completable that retries when …" sounds more natural I guess
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I kept this in sync with all of the other retry* java doc sentences.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, yeah all rx types have different phrasing for retry operator, alight
@@ -2649,6 +2649,26 @@ public final T blockingGet() { | |||
return toSingle(toFlowable().retry(predicate)); | |||
} | |||
|
|||
/** | |||
* Repeatedly re-subscribe at most times or until the predicate returns false, whichever happens first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Let's make it more consistent with javadoc you've added for Completable? It didn't mention Repeatedly
and was emphasizing error condition, while with this javadoc you only realize in the end of it that error is initial trigger for whole operator
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It should be yeah but if we only change this method then this one is inconsistent with all of the other Single methods.
} | ||
}) | ||
.test() | ||
.assertFailure(IllegalArgumentException.class); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
hm, I believe you should check atomicInteger value here to verify actual number of action retries
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same below and in tests for other reactive types
The latest changes broke the tests. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
@@ -1545,6 +1545,28 @@ public final Completable retry(long times) { | |||
return fromPublisher(toFlowable().retry(times)); | |||
} | |||
|
|||
/** | |||
* Returns a Completable that when this Completable emits an error, retries at most times |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
uh, yeah all rx types have different phrasing for retry operator, alight
Happy to get better testing names