clientv3/lease.go
func (l *lessor) deadlineLoop() {
	for {
		select {
		case <-time.After(time.Second):
		case <-l.donec:
			return
		}
		now := time.Now()
		l.mu.Lock()
		for id, ka := range l.keepAlives {
			if ka.deadline.Before(now) {
				// waited too long for response; lease may be expired
				ka.close()
				delete(l.keepAlives, id)
			}
		}
		l.mu.Unlock()
	}
}
func (l *lessor) deadlineLoop() {
	for {
		select {
		case <-time.After(time.Second):
		case <-l.donec:
			return
		}
		now := time.Now()
		l.mu.Lock()
		for id, ka := range l.keepAlives {
			if ka.deadline.Before(now) {
				// waited too long for response; lease may be expired
				ka.close()
				delete(l.keepAlives, id)
			}
		}
		l.mu.Unlock()
	}
}
func ( l * lessor ) deadlineLoop ( ) { for { select { case <- time . After ( time . Second ) : case <- l . donec : return } now := time . Now ( ) l . mu . Lock ( ) for id , ka := range l . keepAlives { if ka . deadline . Before ( now ) { // waited too long for response; lease may be expired ka . close ( ) delete ( l . keepAlives , id ) } } l . mu . Unlock ( ) } }
// deadlineLoop reaps any keep alive channels that have not received a response
// within the lease TTL
deadlineLoop reaps any keep alive channels that have not received a response within the lease TTL