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 833aabe4cd
commit 3d3e91c6e3
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
}