contrib/raftexample: follow pipeline guidelines closer

close raft commit channel before issuing raft error since it's done
sending
This commit is contained in:
chz
2015-12-20 11:01:41 -08:00
committed by Anthony Romano
parent b7cf2385e6
commit b73a11ff45
3 changed files with 26 additions and 27 deletions

View File

@ -87,11 +87,15 @@ func TestProposeOnCommit(t *testing.T) {
// feedback for "n" committed entries, then update donec
go func(pC chan<- string, cC <-chan *string, eC <-chan error) {
for n := 0; n < 100; n++ {
s, ok := <-cC
if !ok {
pC = nil
}
select {
case s := <-cC:
pC <- *s
case pC <- *s:
continue
case err, _ := <-eC:
t.Fatalf("eC closed (%v)", err)
t.Fatalf("eC message (%v)", err)
}
}
donec <- struct{}{}