code: func (le *leaderElectionSvcImpl) waitForMembershipStabilization(timeLimit time.Duration) {
  	le.logger.Debug(le.id, ": Entering")
  	defer le.logger.Debug(le.id, ": Exiting, peers found", len(le.adapter.Peers()))
  	endTime := time.Now().Add(timeLimit)
  	viewSize := len(le.adapter.Peers())
  	for !le.shouldStop() {
  		time.Sleep(le.config.MembershipSampleInterval)
  		newSize := len(le.adapter.Peers())
  		if newSize == viewSize || time.Now().After(endTime) || le.isLeaderExists() {
  			return
  		}
  		viewSize = newSize
  	}
  }
docs: // waitForMembershipStabilization waits for membership view to stabilize
  // or until a time limit expires, or until a peer declares itself as a leader