MCPcopy Create free account
hub / github.com/cortexproject/cortex / NewDisableableTicker

Function NewDisableableTicker

pkg/util/time.go:114–121  ·  view source on GitHub ↗

NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing zero duration as the interval. Returns a function for stopping the ticker, and the ticker channel.

(interval time.Duration)

Source from the content-addressed store, hash-verified

112// NewDisableableTicker essentially wraps NewTicker but allows the ticker to be disabled by passing
113// zero duration as the interval. Returns a function for stopping the ticker, and the ticker channel.
114func NewDisableableTicker(interval time.Duration) (func(), <-chan time.Time) {
115 if interval == 0 {
116 return func() {}, nil
117 }
118
119 tick := time.NewTicker(interval)
120 return func() { tick.Stop() }, tick.C
121}
122
123// FindMinMaxTime returns the time in milliseconds of the earliest and latest point in time the statement will try to process.
124// This takes into account offsets, @ modifiers, and range selectors.

Calls 1

StopMethod · 0.65