mvcc/watchable_store.go
func (s *watchableStore) syncVictimsLoop() {
	defer s.wg.Done()

	for {
		for s.moveVictims() != 0 {
			// try to update all victim watchers
		}
		s.mu.RLock()
		isEmpty := len(s.victims) == 0
		s.mu.RUnlock()

		var tickc <-chan time.Time
		if !isEmpty {
			tickc = time.After(10 * time.Millisecond)
		}

		select {
		case <-tickc:
		case <-s.victimc:
		case <-s.stopc:
			return
		}
	}
}
func (s *watchableStore) syncVictimsLoop() {
	defer s.wg.Done()

	for {
		for s.moveVictims() != 0 {
			// try to update all victim watchers
		}
		s.mu.RLock()
		isEmpty := len(s.victims) == 0
		s.mu.RUnlock()

		var tickc <-chan time.Time
		if !isEmpty {
			tickc = time.After(10 * time.Millisecond)
		}

		select {
		case <-tickc:
		case <-s.victimc:
		case <-s.stopc:
			return
		}
	}
}
func ( s * watchableStore ) syncVictimsLoop ( ) { defer s . wg . Done ( ) for { for s . moveVictims ( ) != 0 { // try to update all victim watchers } s . mu . RLock ( ) isEmpty := len ( s . victims ) == 0 s . mu . RUnlock ( ) var tickc <- chan time . Time if ! isEmpty { tickc = time . After ( 10 * time . Millisecond ) } select { case <- tickc : case <- s . victimc : case <- s . stopc : return } } }
// syncVictimsLoop tries to write precomputed watcher responses to
// watchers that had a blocked watcher channel
syncVictimsLoop tries to write precomputed watcher responses to watchers that had a blocked watcher channel