Raft协议详解-leader发送心跳代码go
如果已经把最新的log更新了,那就多等一会,反之,很快就广播AppendEntries(也就是心跳消息)
func (rf *Raft) LeaderState() {
time.Sleep(10 * time.Millisecond)
if rf.LastApplied == rf.CommitIndex {
time.Sleep(25 * time.Millisecond)
}
go rf.BroadcastAppendEntriesRPC()
}