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

Method init

esutil/bulk_indexer.go:532–545  ·  view source on GitHub ↗

init initializes the bulk indexer.

()

Source from the content-addressed store, hash-verified

530
531// init initializes the bulk indexer.
532func (bi *bulkIndexer) init() {
533 for i := 1; i <= bi.config.NumWorkers; i++ {
534 bi.wg.Add(1)
535 w := worker{
536 id: i,
537 ch: make(chan BulkIndexerItem, bi.config.QueueSizeMultiplier),
538 bi: bi,
539 buf: bytes.NewBuffer(make([]byte, 0, bi.config.FlushBytes)),
540 ticker: time.NewTicker(bi.nextFlushInterval()),
541 }
542 w.run()
543 bi.workers = append(bi.workers, &w)
544 }
545}
546
547// nextFlushInterval returns FlushInterval plus a random jitter in
548// [0, FlushJitter) when FlushJitter > 0. Callers are independent worker

Callers 1

NewBulkIndexerFunction · 0.95

Calls 3

nextFlushIntervalMethod · 0.95
runMethod · 0.95
AddMethod · 0.65

Tested by

no test coverage detected