func()

in store/engine/raft/node.go [375:397]


func (n *Node) IsReady(ctx context.Context) bool {
	tries := 0
	for {
		select {
		case <-n.shutdown:
			return false
		case <-time.After(200 * time.Millisecond):
			// wait for the leader to be elected
			if n.GetRaftLead() != raft.None {
				return true
			}

			tries++
			if tries >= 10 {
				// waiting too long, just return the running status
				n.logger.Warn("Leader not elected, return the running status")
				return n.isRunning.Load()
			}
		case <-ctx.Done():
			return false
		}
	}
}