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

feat(kotlin): add switchIfEmpty with deferred execution #1460

Conversation

davinkevin
Copy link
Contributor

This allows supporting a deferred execution when using the switchIfEmpty operator

@codecov-io
Copy link

codecov-io commented Dec 8, 2018

Codecov Report

Merging #1460 into master will decrease coverage by 0.03%.
The diff coverage is 0%.

Impacted file tree graph

@@             Coverage Diff              @@
##             master    #1460      +/-   ##
============================================
- Coverage     84.29%   84.25%   -0.04%     
+ Complexity     3894     3893       -1     
============================================
  Files           358      358              
  Lines         29426    29427       +1     
  Branches       5464     5464              
============================================
- Hits          24804    24794      -10     
- Misses         3026     3031       +5     
- Partials       1596     1602       +6
Impacted Files Coverage Δ Complexity Δ
...in/kotlin/reactor/core/publisher/MonoExtensions.kt 83.33% <ø> (ø) 0 <0> (ø) ⬇️
...in/kotlin/reactor/core/publisher/FluxExtensions.kt 88.46% <0%> (-3.54%) 0 <0> (ø)
.../java/reactor/core/publisher/FluxLimitRequest.java 94% <0%> (-4%) 5% <0%> (ø)
.../java/reactor/core/scheduler/ElasticScheduler.java 83.47% <0%> (-1.66%) 26% <0%> (ø)
...in/java/reactor/core/publisher/FluxWindowWhen.java 80.28% <0%> (-1.45%) 2% <0%> (ø)
...c/main/java/reactor/core/publisher/RingBuffer.java 70.56% <0%> (-0.95%) 24% <0%> (ø)
.../main/java/reactor/core/publisher/FluxFlatMap.java 94.4% <0%> (-0.58%) 13% <0%> (ø)
...ain/java/reactor/core/publisher/FluxConcatMap.java 89.85% <0%> (-0.57%) 7% <0%> (ø)
...c/main/java/reactor/core/publisher/FluxReplay.java 83.85% <0%> (-0.32%) 24% <0%> (-1%)
...ain/java/reactor/core/publisher/FluxPublishOn.java 86.59% <0%> (-0.21%) 6% <0%> (ø)
... and 6 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 2cbc53d...5729987. Read the comment docs.

Copy link
Member

@simonbasle simonbasle left a comment

Choose a reason for hiding this comment

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

Looks good to me, can you change the @since TBD to @since 3.2?

@davinkevin davinkevin force-pushed the add-switchifempty-with-deferred-execution branch from 999b8cc to d640e2b Compare December 10, 2018 17:48
@davinkevin
Copy link
Contributor Author

Modification made. I've set version 3.2 on the @since.

I've also modified a signature method to accept Publisher instead of Mono in the FluxExtensions.kt.

👍

@davinkevin davinkevin force-pushed the add-switchifempty-with-deferred-execution branch from d640e2b to 25d67f7 Compare December 10, 2018 18:38
@@ -202,3 +202,12 @@ fun <T : Any, E : Throwable> Flux<T>.onErrorReturn(exceptionType: KClass<E>, val
* @since 3.1
*/
fun <T : Any> Flux<out Iterable<T>>.split(): Flux<T> = this.flatMapIterable { it }

/**
* Extension for [Flux.switchIfEmpty] accepting a function providing a Mono. This allows having a deferred execution with
Copy link
Member

Choose a reason for hiding this comment

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

"a function providing a Mono" -> "a function providing a Publisher"

…itchIfEmpty(s: () -> Publisher<T>)`

This allows supporting a deferred execution when using the `switchIfEmpty` operator
@davinkevin davinkevin force-pushed the add-switchifempty-with-deferred-execution branch from 25d67f7 to 5729987 Compare December 11, 2018 10:56
@simonbasle simonbasle merged commit 94d20e7 into reactor:master Dec 13, 2018
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.

None yet

3 participants