Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchSender ¶
type BatchSender struct {
// contains filtered or unexported fields
}
BatchSender is a helper struct that batches items and sends them in batches of batchSize or after batchTimeout.
- If item is already a slice, it will be sent directly - Otherwise, it will be added to the current batch - If the current batch has reached the batch size, it will be sent immediately - Otherwise, a timer will be started to send the current batch after the batch timeout
func NewBatchSender ¶
func NewBatchSender(sendFn func(any)) *BatchSender
func (*BatchSender) Close ¶
func (bs *BatchSender) Close()
func (*BatchSender) Send ¶
func (bs *BatchSender) Send(item any)
Click to show internal directories.
Click to hide internal directories.