Commit 1f24297e authored by Wojciech Tyczynski's avatar Wojciech Tyczynski

Merge pull request #18921 from timothysc/etcd_datarace

Fix data race on cancel variable in etcd code
parents 7851d24d e3311aa9
......@@ -158,7 +158,9 @@ func (w *etcdWatcher) etcdWatch(ctx context.Context, client etcd.KeysAPI, key st
AfterIndex: resourceVersion,
}
watcher := client.Watcher(key, &opts)
w.stopLock.Lock()
w.ctx, w.cancel = context.WithCancel(ctx)
w.stopLock.Unlock()
for {
resp, err := watcher.Next(w.ctx)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment