@@ -35,10 +35,10 @@ func (f FlushFunc[T]) Flush(elements []T) error {
35
35
}
36
36
37
37
// DefaultErrHandler prints error and the size of elements to stderr.
38
- func DefaultErrHandler [T any ](err error , flat []T ) {
38
+ func DefaultErrHandler [T any ](err error , elements []T ) {
39
39
fmt .Fprintf (
40
40
os .Stderr ,
41
- "async-buffer: error while flushing error = %v, backup size = %d\n " , err , len (flat ))
41
+ "async-buffer: error while flushing error = %v, backup size = %d\n " , err , len (elements ))
42
42
}
43
43
44
44
// Option for New the buffer.
@@ -56,7 +56,7 @@ type Option[T any] struct {
56
56
// There is automatic flushing if zero FlushInterval.
57
57
FlushInterval time.Duration
58
58
// ErrHandler handles errors, print error and the size of elements to stderr in default.
59
- ErrHandler func (error , []T )
59
+ ErrHandler func (err error , elements []T )
60
60
}
61
61
62
62
// Buffer represents an async buffer.
@@ -205,13 +205,13 @@ func (b *Buffer[T]) run() {
205
205
}
206
206
}
207
207
208
- func (b * Buffer [T ]) internalFlush (ts []T ) {
209
- if len (ts ) == 0 {
208
+ func (b * Buffer [T ]) internalFlush (elements []T ) {
209
+ if len (elements ) == 0 {
210
210
return
211
211
}
212
212
213
- flat := make ([]T , len (ts ))
214
- copy (flat , ts )
213
+ flat := make ([]T , len (elements ))
214
+ copy (flat , elements )
215
215
216
216
done := make (chan struct {}, 1 )
217
217
go func () {
0 commit comments