( tempoWriteBackoffDuration time.Duration, tempoReadBackoffDuration time.Duration, tempoSearchBackoffDuration time.Duration, tempoMetricsBackoffDuration time.Duration, )
| 263 | } |
| 264 | |
| 265 | func initTickers( |
| 266 | tempoWriteBackoffDuration time.Duration, |
| 267 | tempoReadBackoffDuration time.Duration, |
| 268 | tempoSearchBackoffDuration time.Duration, |
| 269 | tempoMetricsBackoffDuration time.Duration, |
| 270 | ) ( |
| 271 | tickerWrite *time.Ticker, |
| 272 | tickerRead *time.Ticker, |
| 273 | tickerSearch *time.Ticker, |
| 274 | tickerMetrics *time.Ticker, |
| 275 | err error, |
| 276 | ) { |
| 277 | if tempoWriteBackoffDuration <= 0 { |
| 278 | return nil, nil, nil, nil, errors.New("tempo-write-backoff-duration must be greater than 0") |
| 279 | } |
| 280 | tickerWrite = time.NewTicker(tempoWriteBackoffDuration) |
| 281 | if tempoReadBackoffDuration > 0 { |
| 282 | tickerRead = time.NewTicker(tempoReadBackoffDuration) |
| 283 | } |
| 284 | if tempoSearchBackoffDuration > 0 { |
| 285 | tickerSearch = time.NewTicker(tempoSearchBackoffDuration) |
| 286 | } |
| 287 | if tempoMetricsBackoffDuration > 0 { |
| 288 | tickerMetrics = time.NewTicker(tempoMetricsBackoffDuration) |
| 289 | } |
| 290 | if tickerRead == nil && tickerSearch == nil && tickerMetrics == nil { |
| 291 | return nil, nil, nil, nil, errors.New("at least one of tempo-search-backoff-duration, tempo-read-backoff-duration or tempo-metrics-backoff-duration must be set") |
| 292 | } |
| 293 | return tickerWrite, tickerRead, tickerSearch, tickerMetrics, nil |
| 294 | } |
| 295 | |
| 296 | // Don't attempt to read on the first iteration if we can't reasonably |
| 297 | // expect the write loop to have fired yet. Double the duration here to |
no outgoing calls