-
Notifications
You must be signed in to change notification settings - Fork 3.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
alsoTo eager cancellation #24291 #24423
Conversation
Thank you for your pull request! After a quick sanity check one of the team will reply with 'OK TO TEST' to kick off our automated validation on Jenkins. This compiles the project, runs the tests, and checks for things like binary compatibility and source code formatting. When two team members have also manually reviewed and (perhaps after asking for some amendments) accepted your contribution, it should be good to be merged. For more details about our contributing process, check out CONTRIBUTING.md - and feel free to ask! |
OK TO TEST |
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.
LGTM
@@ -716,6 +716,8 @@ Attaches the given `Sink` to this `Flow`, meaning that elements that pass throug | |||
|
|||
**completes** when upstream completes | |||
|
|||
**Cancels** when downstream or `Sink` cancels |
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.
Nitpick: the other entries ones start with a lowercase letter
Refs #24291 |
Test FAILed. |
Seems there are a few tests relying on the old behavior of |
@johanandren. Indeed. The tests make use of alsoTo to force a behaviour that could be achieved by other means (at least by a raw Broadcast). But who else relies on this? Should I fix up the tests or do we (you guys) need to rethink and maybe have eagerCancel as a parameter of alsoTo? |
I still think eager cancellation is the intuitive behavior, and maybe the other case, where you don't care so much is satisfied with |
OK. Will take a look at fixing up the tests when I get chance. |
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.
LGTM
550967d
to
94d8b41
Compare
Please can someone check I haven't altered the semantics of the three tests I fixed that were affected by the changed behaviour of |
Test FAILed. |
94d8b41
to
d454ad3
Compare
Test PASSed. |
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.
LGTM
Sorry about us being slow here, I think this is ready for merge, but now needs a rebase first. |
d454ad3
to
db64e8a
Compare
Test PASSed. |
Thanks! |
No problem. Glad I could help. |
@@ -1137,7 +1137,7 @@ class SubSource[+Out, +Mat](delegate: scaladsl.SubFlow[Out, Mat, scaladsl.Source | |||
* | |||
* '''Completes when''' upstream completes | |||
* | |||
* '''Cancels when''' downstream cancels | |||
* '''Cancels when''' downstream or Sink cancels | |||
*/ | |||
def alsoTo(that: Graph[SinkShape[Out], _]): SubSource[Out, Mat] = |
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.
Could we have introduced an overload with the eager parameter?
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 think it was discussed and if you don't care about the side stream you should use the new wireTap (or graph dsl with Broadcast for power user full control)
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'm not sure that's a good idea; that conflates the 2 decisions:
- if the "other" should backpressure the upstream (wireTap -- things get dropped for "other"; alsoTo -- things are backpressured)
- and what happens when "other" cancels (wireTap -- "other" completing does not cancel upstream; alsoTo -- completion of "other" does cancel the upstream)
But dropping on backpressure into "other" yet cancelling if it terminates could also be a valid use case?
No description provided.