go-buffer
go-buffer copied to clipboard
Handle flush errors by putting values back in the buffer
Prerequisites
- [✔️] I searched to see if the issue already exists.
Description
I looked into the source code and found that values would be discarded if any error occurred during a flush.
// flush performs a flush asynchronuously.
func (b *Buffer) flush() {
values := b.values
b.values = nil
// ...
go func() {
b.doFlush(values)
b.pendingFlushes.Done()
}()
}
func (b *Buffer) doFlush(values []interface{}) {
// ...
err := b.handleFlush(ctx, values)
// ...
if err != nil {
b.handleError(err)
}
}
Shouldn't it put all the values back in the buffer if it can't flush them successfully?