Esempio n. 1
0
func newDelayingQueue(clock clock.Clock, name string) DelayingInterface {
	ret := &delayingType{
		Interface:          NewNamed(name),
		clock:              clock,
		heartbeat:          clock.Tick(maxWait),
		stopCh:             make(chan struct{}),
		waitingTimeByEntry: map[t]time.Time{},
		waitingForAddCh:    make(chan waitFor, 1000),
		metrics:            newRetryMetrics(name),
	}

	go ret.waitingLoop()

	return ret
}
Esempio n. 2
0
func sinceInMicroseconds(clock clock.Clock, start time.Time) float64 {
	return float64(clock.Since(start).Nanoseconds() / time.Microsecond.Nanoseconds())
}