[Issue #897] Flush on unbatched producer panics #898
Closed
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Fixes #897
Am not certain if this is the right place or behavior, so opening it up for comments. It might be that it is fine to panic on a
Flush()
to a non-batching producer, provided it's explicitly documented, but probably not. It's worth noting that it worked in the past, which is how I ran into the issue in the first place, since I left an errantFlush()
call behind in some tests after disabling batching on a producer.Master Issue: #
Motivation
No one wants a panic, especially one that is undocumented.
Modifications
nil check.
Verifying this change
I've included tests.
Documentation
Since this issue would normally cause a panic, it's probably not necessary to document anything special, especially considering that a similar check is made elsewhere throughout the code. If requested, I can add a comment to the
Flush()
Godoc mentioning that it is a no-op for non-batching producers.