internal virtual void UpdateProgress(FollowerState followerState) { if (_finished) { return; } bool achievedTarget = followerState.MatchIndex >= _targetIndex; if (achievedTarget && (_clock.millis() - _roundStartTime) <= _roundTimeout) { _goalAchieved = true; _finished = true; } else if (_clock.millis() > (_startTime + _catchupTimeout)) { _finished = true; } else if (achievedTarget) { if (_roundCount < MAX_ROUNDS) { _roundCount++; _roundStartTime = _clock.millis(); _targetIndex = _raftLog.appendIndex(); } else { _finished = true; } } }
internal virtual bool Achieved(FollowerState followerState) { if (followerState.MatchIndex >= _targetIndex) { if ((_clock.millis() - _startTime) <= _electionTimeout) { return(true); } else if (_roundCount < MAX_ROUNDS) { _roundCount++; _startTime = _clock.millis(); _targetIndex = _raftLog.appendIndex(); } } return(false); }