Help us shape the future of Go! Take the 2026 Go Developer Survey

batchsender

package
v4.99.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Oct 26, 2026 License: MPL-2.0 Imports: 3 Imported by: 0

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) Flush added in v4.99.0

func (bs *BatchSender) Flush()

Flush sends the buffered items and waits for sendFn to return.

func (*BatchSender) Send

func (bs *BatchSender) Send(item any)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL