Skip to content

Commit f310df2

Browse files
committed
Batch flush added to readme
1 parent 199baef commit f310df2

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

README.md

+8
Original file line numberDiff line numberDiff line change
@@ -93,6 +93,14 @@ batch.Init(a.BatchSize, onPush, onFlush)
9393
if err := batch.Push(item); err != nil {
9494
return err
9595
}
96+
97+
...
98+
99+
// flush anything remaining in the batch
100+
if err := a.batch.Flush(); err != nil {
101+
return err
102+
}
103+
96104
```
97105

98106
Where the push handler (called when a batch is large enough to dequeue, or is flushed) might look something like:

0 commit comments

Comments
 (0)