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 window() with start/end selector not disposing/cancelling properly #6398

Merged
merged 2 commits into from
Feb 13, 2019

Conversation

akarnokd
Copy link
Member

@akarnokd akarnokd commented Feb 5, 2019

This PR fixes the start-end selector variant of Observable.window and Flowable.window to properly

  • dispose the window-opening sequence upon disposing the main output flow and
  • disposing the main upstream upon disposing the main output flow provided there are no windows open.

Fixes: #6397

@akarnokd akarnokd added this to the 2.2 backlog milestone Feb 5, 2019
@akarnokd akarnokd changed the title 2.x: Fix window() with s/e selector not disposing/cancelling properly 2.x: Fix window() with start/end selector not disposing/cancelling properly Feb 5, 2019
@codecov
Copy link

codecov bot commented Feb 5, 2019

Codecov Report

Merging #6398 into 2.x will increase coverage by 0.01%.
The diff coverage is 88.88%.

Impacted file tree graph

@@             Coverage Diff              @@
##                2.x    #6398      +/-   ##
============================================
+ Coverage     98.24%   98.26%   +0.01%     
+ Complexity     6294     6292       -2     
============================================
  Files           675      675              
  Lines         45156    45162       +6     
  Branches       6239     6243       +4     
============================================
+ Hits          44365    44378      +13     
+ Misses          247      243       -4     
+ Partials        544      541       -3
Impacted Files Coverage Δ Complexity Δ
...ators/flowable/FlowableWindowBoundarySelector.java 90.96% <88.88%> (+4.17%) 2 <0> (ø) ⬇️
...s/observable/ObservableWindowBoundarySelector.java 91.56% <88.88%> (+0.76%) 2 <0> (ø) ⬇️
.../io/reactivex/internal/schedulers/IoScheduler.java 90.42% <0%> (-3.2%) 9% <0%> (ø)
...a/io/reactivex/internal/util/QueueDrainHelper.java 97.22% <0%> (-2.78%) 56% <0%> (-2%)
...rnal/operators/observable/ObservableSwitchMap.java 93.61% <0%> (-2.66%) 3% <0%> (ø)
...activex/internal/observers/QueueDrainObserver.java 97.43% <0%> (-2.57%) 21% <0%> (-1%)
...x/internal/operators/flowable/FlowablePublish.java 96.2% <0%> (-2.11%) 11% <0%> (ø)
...activex/internal/schedulers/ScheduledRunnable.java 98.07% <0%> (-1.93%) 29% <0%> (-1%)
...tivex/internal/operators/single/SingleTimeout.java 98.33% <0%> (-1.67%) 2% <0%> (ø)
...io/reactivex/subscribers/SerializedSubscriber.java 98.86% <0%> (-1.14%) 26% <0%> (-1%)
... and 23 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 6e266af...b2e8c2b. Read the comment docs.


TestSubscriber<Flowable<Integer>> ts = source.window(boundary, Functions.justFunction(Flowable.never()))
.test(0L)
;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why on it's own line?

Copy link
Member Author

Choose a reason for hiding this comment

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

A habit if more methods are ever chained onto them.

// FIXME subject has subscribers because of the open window
assertTrue(open.hasSubscribers());
// Disposing the outer sequence stops the opening of new windows
assertFalse(open.hasSubscribers());
Copy link
Collaborator

Choose a reason for hiding this comment

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

Nice that we can fix this too!

@akarnokd akarnokd merged commit 184a17b into ReactiveX:2.x Feb 13, 2019
@akarnokd akarnokd deleted the WindowBoundarySelectorFix branch February 13, 2019 08:51
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.6] window() operator leaks subscriptions
2 participants