如果已经把最新的log更新了,那就多等一会,反之,很快就广播AppendEntries(也就是心跳消息)
func (rf *Raft) LeaderState() {
time.Sleep(10 * time.Millisecond)
if rf.LastApplied == rf.CommitIndex {
time.Sleep(25 * time.Millisecond)
}
go rf.BroadcastAppendEntriesRPC()
}
时间: 2024-12-06 01:47:51