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: Fix Completable.andThen(Completable) not running on observeOn scheduler. #6362

Merged
merged 3 commits into from
Jan 12, 2019

Conversation

pjastrz
Copy link
Contributor

@pjastrz pjastrz commented Jan 12, 2019

This PR fixes unpredictable scheduler/thread used by Completable.observeOn(...)andThen(Completable), since sometimes scheduler defined in observeOn(...) was not used. It was inconsistent with similar .andThen(Maybe) and .andThen(Single), since those are guaranteed to run second Completable using proper scheduler if defined with .observeOn.
Fixes: #6354.

@Test
public void andThenCompletableCompleteError() {
Completable.complete()
.andThen(Completable.error(new RuntimeException("test")))
Copy link
Member

Choose a reason for hiding this comment

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

Please use TestException so we don't mistake them with any other RuntimeException failures.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ok, done.

@@ -69,39 +63,4 @@ public void andThenMaybeError() {
.assertError(RuntimeException.class)
.assertErrorMessage("bla");
}

@Test
public void andThenNoInterrupt() throws InterruptedException {
Copy link
Member

Choose a reason for hiding this comment

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

Why was this test removed without explanation?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I moved it to CompletableAndThenCompletableTest since it specifically tested .andThen(Completable).

@codecov
Copy link

codecov bot commented Jan 12, 2019

Codecov Report

Merging #6362 into 2.x will decrease coverage by 0.03%.
The diff coverage is 96.96%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6362      +/-   ##
============================================
- Coverage     98.28%   98.25%   -0.04%     
- Complexity     6285     6286       +1     
============================================
  Files           672      673       +1     
  Lines         44990    45021      +31     
  Branches       6223     6224       +1     
============================================
+ Hits          44219    44234      +15     
- Misses          243      250       +7     
- Partials        528      537       +9
Impacted Files Coverage Δ Complexity Δ
src/main/java/io/reactivex/Completable.java 100% <100%> (ø) 120 <1> (ø) ⬇️
...ors/completable/CompletableAndThenCompletable.java 96.66% <96.66%> (ø) 2 <2> (?)
...ernal/operators/flowable/FlowableFlatMapMaybe.java 88.88% <0%> (-6.29%) 2% <0%> (ø)
...nternal/operators/observable/ObservableCreate.java 93.16% <0%> (-5.99%) 2% <0%> (ø)
...ternal/operators/observable/ObservablePublish.java 94.69% <0%> (-3.54%) 11% <0%> (ø)
...rnal/operators/flowable/FlowableFlatMapSingle.java 92.93% <0%> (-2.72%) 2% <0%> (ø)
...l/operators/observable/ObservableFlatMapMaybe.java 92.15% <0%> (-2.62%) 2% <0%> (ø)
.../operators/mixed/FlowableSwitchMapCompletable.java 98.94% <0%> (-1.06%) 2% <0%> (ø)
.../operators/mixed/FlowableConcatMapCompletable.java 99.14% <0%> (-0.86%) 2% <0%> (ø)
...vex/internal/operators/flowable/FlowableCache.java 97.72% <0%> (-0.76%) 37% <0%> (-1%)
... and 22 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 090f99e...e424b4b. Read the comment docs.

@akarnokd akarnokd merged commit d7d0a33 into ReactiveX:2.x Jan 12, 2019
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.

2.2.5: observeOn might not work for Completable.andThen(Completable)
3 participants