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.
Send Partial Batch will force partial batches to send right away when calling Writer.WriteMessages instead of blocking until a full batch is made or the timeout is seen.
I have run into the same issue seen in #852 this issue and took a whack at implementing a new setting to output batches right away. My implementation is nearly identical to #1167. Unfortunately I didn't do my homework ahead of time and just re-invented the same solution.
This does add a test to ensure the solution works, and implements the deprecated pattern as well, since it is required in the testing. Further more I removed the unnecessary goroutine which fires the batch after the timeout, since the batch will always flush.