contrib/raftexample: Publish only committed entries

We shouldn't publish entries to the kvstore until they've been
committed.
This commit is contained in:
Adam Wolfe Gordon 2016-02-05 11:17:15 -07:00
parent 8f3e17b781
commit a31f9a8af1

View File

@ -228,7 +228,7 @@ func (rc *raftNode) serveChannels() {
rc.wal.Save(rd.HardState, rd.Entries)
rc.raftStorage.Append(rd.Entries)
rc.transport.Send(rd.Messages)
if ok := rc.publishEntries(rd.Entries); !ok {
if ok := rc.publishEntries(rd.CommittedEntries); !ok {
rc.stop()
return
}