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

Producer: block in Close without Return.Errors #787

Merged
merged 1 commit into from
Nov 24, 2016

Conversation

eapache
Copy link
Contributor

@eapache eapache commented Nov 22, 2016

If neither Return.Errors nor Return.Successes was set then Close wouldn't
actually block at all. This is arguably correct given the send-it-into-the-void-
and-pray configuration but it was still surprising.

It turns out to be a very minimal change to block anyway (since the Errors
channel is still present and closed at the appropriate moment) so just do that.
Also add a test for this configuration, since it's not one I remember to think
about on the regular.

@hchargois after poking around the code a bit I decided it was simpler to just fix this the way you suggested. Let me know if this works for you.

Closes #784.

If neither `Return.Errors` nor `Return.Successes` was set then `Close` wouldn't
actually block at all. This is arguably correct given the send-it-into-the-void-
and-pray configuration but it was still surprising.

It turns out to be a very minimal change to block anyway (since the `Errors`
channel is still present and closed at the appropriate moment) so just do that.
Also add a test for this configuration, since it's not one I remember to think
about on the regular.
@hchargois
Copy link

This is awesome, I love how simple the solution was and it works beautifully. Thanks :)

@eapache eapache merged commit f4842fc into master Nov 24, 2016
@eapache eapache deleted the block-even-if-no-errors-returned branch November 24, 2016 15:37
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.

AsyncProducer.Close() doesn't flush if conf.Producer.Return.Errors is false
2 participants