code: func (b *BulkIndexer) startTimer() {
  	ticker := time.NewTicker(b.BufferDelayMax)
  	go func() {
  		for {
  			select {
  			case <-ticker.C:
  				b.mu.Lock()
  				// don't send unless last sendor was the time,
  				// otherwise an indication of other thresholds being hit
  				// where time isn't needed
  				if b.buf.Len() > 0 && b.needsTimeBasedFlush {
  					b.needsTimeBasedFlush = true
  					b.send(b.buf)
  				} else if b.buf.Len() > 0 {
  					b.needsTimeBasedFlush = true
  				}
  				b.mu.Unlock()
  			case <-b.timerDoneChan:
  				// shutdown this go routine
  				ticker.Stop()
  				return
  			}
  
  		}
  	}()
  }
docs: // start a timer for checking back and forcing flush ever BulkDelaySeconds seconds
  // even if we haven't hit max messages/size