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

2.x: Add retry(times, predicate) to Single & Completable and verify behavior across them and Maybe. #5753

Merged
merged 4 commits into from
Dec 7, 2017
Merged

Conversation

vanniktech
Copy link
Collaborator

  • Add retry(times, predicate) to Single & Completable (Maybe had it already) which just forwards to Flowable for now
  • verify behavior across the three reactive types

Happy to get better testing names

@akarnokd akarnokd added this to the 2.2 milestone Dec 5, 2017
@vanniktech
Copy link
Collaborator Author

vanniktech commented Dec 5, 2017

Given you've added this to the 2.2 milestone should I update the @since to 2.2.0 then?

@akarnokd
Copy link
Member

akarnokd commented Dec 5, 2017

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
Copy link

codecov bot commented Dec 5, 2017

Codecov Report

Merging #5753 into 2.x will decrease coverage by 0.03%.
The diff coverage is 100%.

Impacted file tree graph

@@             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
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Completable.java 100% <100%> (ø) 115 <1> (+1) ⬆️
src/main/java/io/reactivex/Single.java 100% <100%> (ø) 137 <1> (+1) ⬆️
...nternal/operators/observable/ObservableCreate.java 79.48% <0%> (-18.81%) 2% <0%> (ø)
...rnal/operators/flowable/FlowableFlatMapSingle.java 92.93% <0%> (-3.81%) 2% <0%> (ø)
...tivex/internal/observers/FutureSingleObserver.java 94.33% <0%> (-3.78%) 24% <0%> (-1%)
.../io/reactivex/internal/schedulers/IoScheduler.java 89.24% <0%> (-3.23%) 9% <0%> (ø)
...activex/internal/observers/QueueDrainObserver.java 61.53% <0%> (-2.57%) 12% <0%> (-1%)
.../main/java/io/reactivex/subjects/MaybeSubject.java 97.82% <0%> (-2.18%) 47% <0%> (-1%)
...nternal/operators/observable/ObservableWindow.java 98% <0%> (-2%) 3% <0%> (ø)
...ex/internal/subscribers/InnerQueuedSubscriber.java 96.07% <0%> (-1.97%) 18% <0%> (-1%)
... and 32 more

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 4d2e821...a89cb4e. Read the comment docs.

Copy link
Contributor

@artem-zinnatullin artem-zinnatullin left a 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
Copy link
Contributor

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

Copy link
Collaborator Author

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.

Copy link
Contributor

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
Copy link
Contributor

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

Copy link
Collaborator Author

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);
Copy link
Contributor

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

Copy link
Contributor

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

@akarnokd
Copy link
Member

akarnokd commented Dec 7, 2017

The latest changes broke the tests.

Copy link
Contributor

@artem-zinnatullin artem-zinnatullin left a 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
Copy link
Contributor

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

@akarnokd akarnokd merged commit 34242e1 into ReactiveX:2.x Dec 7, 2017
@vanniktech vanniktech deleted the 2.xretryTimesPredicate branch December 8, 2017 07:34
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants