MCPcopy
hub / github.com/elastic/go-elasticsearch / nextFlushInterval

Method nextFlushInterval

esutil/bulk_indexer.go:550–555  ·  view source on GitHub ↗

nextFlushInterval returns FlushInterval plus a random jitter in [0, FlushJitter) when FlushJitter > 0. Callers are independent worker goroutines; math/rand's top-level functions are goroutine-safe.

()

Source from the content-addressed store, hash-verified

548// [0, FlushJitter) when FlushJitter > 0. Callers are independent worker
549// goroutines; math/rand's top-level functions are goroutine-safe.
550func (bi *bulkIndexer) nextFlushInterval() time.Duration {
551 if bi.config.FlushJitter <= 0 {
552 return bi.config.FlushInterval
553 }
554 return bi.config.FlushInterval + time.Duration(rand.Int63n(int64(bi.config.FlushJitter))) //nolint:gosec // G404: non-crypto randomness is intentional for flush-interval jitter
555}
556
557// worker represents an indexer worker.
558type worker struct {

Callers 3

initMethod · 0.95
flushMethod · 0.80

Calls 1

DurationMethod · 0.80

Tested by 1