mirror of
https://github.com/etcd-io/etcd.git
synced 2024-09-27 06:25:44 +00:00
clientv3: fix race on writing watch channel over return channel
Found in TestElectionFailover
This commit is contained in:
parent
5ee85bea7c
commit
4bdfc0a46d
@ -240,11 +240,11 @@ func (w *watcher) addStream(resp *pb.WatchResponse, pendingReq *watchRequest) {
|
|||||||
w.streams[ws.id] = ws
|
w.streams[ws.id] = ws
|
||||||
w.mu.Unlock()
|
w.mu.Unlock()
|
||||||
|
|
||||||
// send messages to subscriber
|
|
||||||
go w.serveStream(ws)
|
|
||||||
|
|
||||||
// pass back the subscriber channel for the watcher
|
// pass back the subscriber channel for the watcher
|
||||||
pendingReq.retc <- ret
|
pendingReq.retc <- ret
|
||||||
|
|
||||||
|
// send messages to subscriber
|
||||||
|
go w.serveStream(ws)
|
||||||
}
|
}
|
||||||
|
|
||||||
// closeStream closes the watcher resources and removes it
|
// closeStream closes the watcher resources and removes it
|
||||||
|
Loading…
x
Reference in New Issue
Block a user