etcd-runner: fix race on nextc

This commit is contained in:
fanmin shi 2017-05-10 11:21:17 -07:00
parent 87d99fe038
commit b44bd6d2a9

View File

@ -129,8 +129,10 @@ func runElectionFunc(cmd *cobra.Command, args []string) {
return err
}
if observedLeader == v {
close(nextc)
oldNextc := nextc
nextc = make(chan struct{})
close(oldNextc)
}
<-rcNextc
observedLeader = ""