clientv3: remove v3.WithFirstKey() in Barrier.Wait()

fix the unexpected blocking when using Barrier.Wait(), e.g.
NewBarrier(client, "a").Wait() will block if key "a" is not existed but "a0" is existed, but it should return immediately.

Signed-off-by: zhangwenkang <zwenkang@vmware.com>
This commit is contained in:
zhangwenkang
2023-07-04 22:01:54 +08:00
parent f3f37299e6
commit 6be3ad36be
2 changed files with 40 additions and 1 deletions

View File

@@ -49,7 +49,7 @@ func (b *Barrier) Release() error {
// Wait blocks on the barrier key until it is deleted. If there is no key, Wait
// assumes Release has already been called and returns immediately.
func (b *Barrier) Wait() error {
resp, err := b.client.Get(b.ctx, b.key, v3.WithFirstKey()...)
resp, err := b.client.Get(b.ctx, b.key)
if err != nil {
return err
}