Skip to content

Commit

Permalink
clientv3: fix race on writing watch channel over return channel
Browse files Browse the repository at this point in the history
Found in TestElectionFailover
  • Loading branch information
Anthony Romano committed Mar 28, 2016
1 parent 5ee85be commit 4bdfc0a
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions clientv3/watch.go
Original file line number Diff line number Diff line change
Expand Up @@ -240,11 +240,11 @@ func (w *watcher) addStream(resp *pb.WatchResponse, pendingReq *watchRequest) {
w.streams[ws.id] = ws
w.mu.Unlock()

// send messages to subscriber
go w.serveStream(ws)

// pass back the subscriber channel for the watcher
pendingReq.retc <- ret

// send messages to subscriber
go w.serveStream(ws)
}

// closeStream closes the watcher resources and removes it
Expand Down

0 comments on commit 4bdfc0a

Please sign in to comment.