-
Notifications
You must be signed in to change notification settings - Fork 192
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
Need documentation for cancelling flows of finite producers #85
Comments
@aaronrenner I just noticed that almost all of this is documented in the GenStage.from_enumerable/2 function. I am also copying some of this documentation to the Flow module where we can tie it all up together. |
Those changes look great, @josevalim! Would it be worth mentioning that if you want the producer to shut down after it calls |
That's worth talking about too, yes. :) |
Pushed those too. But yes, it is responsibility of the producer. |
The original question was brought up on this ElixirForum post but here's a recap.
@josevalim mentioned that I needed to use
GenStage.async_notify(self(), {:producer, :done})
to shut down all of the consumers and this behavior would be good to document. It would also be good to mention howGenStage.Streamer
tracks the subscriptions and cancellations of its consumers when theconsumers:
is set to:permanent
. It looks like once all of the consumers have been deleted, it returns{:stop, :normal, state}
to shut down itself. Without this tracking it appears the producer won't shut down.I'm also wondering where should documentation for this go? Is
GenStage.async_notify(self(), {:producer, :done})
specific to Flow, or does it work for GenStage as well? I noticed in theGenStage.from_enumerable/2
function it mentions you could also send GenStage.async_notify(self(), {:producer, :halted}). What does that do?Thanks so much for your help!
The text was updated successfully, but these errors were encountered: