etcd: Workaround possible rare deadlock

This code is terrible, but maybe this is good enough for now.
This commit is contained in:
James Shubin
2025-03-11 03:51:05 -04:00
parent 17b859d0d7
commit 1cb9648b08

View File

@@ -462,6 +462,9 @@ func (obj *Simple) ComplexWatcher(ctx context.Context, path string, opts ...etcd
select { // send the error
case eventsChan <- data:
case <-ctx.Done():
if count > 0 { // XXX: hack
wg.Done()
}
return
}
continue // channel should close shortly
@@ -481,6 +484,9 @@ func (obj *Simple) ComplexWatcher(ctx context.Context, path string, opts ...etcd
select { // send the event
case eventsChan <- data:
case <-ctx.Done():
if count > 0 { // XXX: hack
wg.Done()
}
return
}
}