code: func (s *Store) monitorLeaderCh() {
  	defer s.wg.Done()
  
  	incoming := s.raft.LeaderCh()
  	for {
  		select {
  		case <-s.closing:
  			return
  		case isLeader, ok := <-incoming:
  			// Update leader time and clear heartbeats.
  			s.mu.Lock()
  			if isLeader {
  				s.leaderTime = time.Now()
  			} else {
  				s.leaderTime = time.Time{}
  			}
  			s.heartbeats = make(map[instanceKey]time.Time)
  			s.mu.Unlock()
  
  			// If the incoming channel closed then close our leader channel.
  			if !ok {
  				close(s.leaderCh)
  				return
  			}
  
  			// Resend value to store's leader channel.
  			select {
  			case s.leaderCh <- isLeader:
  			default:
  			}
  		}
  	}
  }
docs: // monitors the raft leader channel, updates the leader time, and resends to a local channel.