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.
()
| 548 | // [0, FlushJitter) when FlushJitter > 0. Callers are independent worker |
| 549 | // goroutines; math/rand's top-level functions are goroutine-safe. |
| 550 | func (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. |
| 558 | type worker struct { |