Merge pull request #18921 from timothysc/etcd_datarace

Fix data race on cancel variable in etcd code
This commit is contained in:
Wojciech Tyczynski 2015-12-19 08:09:45 +01:00
commit 1f24297e7a

View File

@ -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)