etcd: Workaround possible rare deadlock
This code is terrible, but maybe this is good enough for now.
This commit is contained in:
@@ -462,6 +462,9 @@ func (obj *Simple) ComplexWatcher(ctx context.Context, path string, opts ...etcd
|
|||||||
select { // send the error
|
select { // send the error
|
||||||
case eventsChan <- data:
|
case eventsChan <- data:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
if count > 0 { // XXX: hack
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
continue // channel should close shortly
|
continue // channel should close shortly
|
||||||
@@ -481,6 +484,9 @@ func (obj *Simple) ComplexWatcher(ctx context.Context, path string, opts ...etcd
|
|||||||
select { // send the event
|
select { // send the event
|
||||||
case eventsChan <- data:
|
case eventsChan <- data:
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
|
if count > 0 { // XXX: hack
|
||||||
|
wg.Done()
|
||||||
|
}
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user