func (q *quiescence) tick() {
	now := time.Now()

	// If this is the first tick, set up the timer and calculate the max
	// deadline.
	if q.timer == nil {
		q.timer = time.NewTimer(q.min)
		go func() {
			select {
			case <-q.timer.C:
				q.ch <- q.template
			}
		}()

		q.deadline = now.Add(q.max)
		return
	}

	// Snooze the timer for the min time, or snooze less if we are coming
	// up against the max time. If the timer has already fired and the reset
	// doesn't work that's ok because we guarantee that the channel gets our
	// template which means that we are obsolete and a fresh quiescence will
	// be set up.
	if now.Add(q.min).Before(q.deadline) {
		q.timer.Reset(q.min)
	} else if dur := q.deadline.Sub(now); dur > 0 {
		q.timer.Reset(dur)
	}
}
func (q *quiescence) tick() {
	now := time.Now()

	
	
	if q.timer == nil {
		q.timer = time.NewTimer(q.min)
		go func() {
			select {
			case <-q.timer.C:
				q.ch <- q.template
			}
		}()

		q.deadline = now.Add(q.max)
		return
	}

	
	
	
	
	
	if now.Add(q.min).Before(q.deadline) {
		q.timer.Reset(q.min)
	} else if dur := q.deadline.Sub(now); dur > 0 {
		q.timer.Reset(dur)
	}
}
func ( q * quiescence ) tick ( ) { now := time . Now ( ) // If this is the first tick, set up the timer and calculate the max // deadline. if q . timer == nil { q . timer = time . NewTimer ( q . min ) go func ( ) { select { case <- q . timer . C : q . ch <- q . template } } ( ) q . deadline = now . Add ( q . max ) return } // Snooze the timer for the min time, or snooze less if we are coming // up against the max time. If the timer has already fired and the reset // doesn't work that's ok because we guarantee that the channel gets our // template which means that we are obsolete and a fresh quiescence will // be set up. if now . Add ( q . min ) . Before ( q . deadline ) { q . timer . Reset ( q . min ) } else if dur := q . deadline . Sub ( now ) ; dur > 0 { q . timer . Reset ( dur ) } }
// tick updates the minimum quiescence timer.
tick updates the minimum quiescence timer .