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()
}

posted on 2016-09-27 17:53  Joker_88  阅读(1044)  评论(0编辑  收藏  举报

导航