Skip to content

Commit

Permalink
etcd-runner: fix race on nextc
Browse files Browse the repository at this point in the history
  • Loading branch information
fanminshi committed May 10, 2017
1 parent 87d99fe commit b44bd6d
Showing 1 changed file with 3 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -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 = ""
Expand Down

0 comments on commit b44bd6d

Please sign in to comment.