|
@@ -23,7 +23,7 @@ import (
|
|
|
// WaitEvents waits on a key until it observes the given events and returns the final one.
|
|
// WaitEvents waits on a key until it observes the given events and returns the final one.
|
|
|
func WaitEvents(c *clientv3.Client, key string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error) {
|
|
func WaitEvents(c *clientv3.Client, key string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error) {
|
|
|
w := clientv3.NewWatcher(c)
|
|
w := clientv3.NewWatcher(c)
|
|
|
- wc := w.Watch(context.Background(), key, rev)
|
|
|
|
|
|
|
+ wc := w.Watch(context.Background(), key, clientv3.WithRev(rev))
|
|
|
if wc == nil {
|
|
if wc == nil {
|
|
|
w.Close()
|
|
w.Close()
|
|
|
return nil, ErrNoWatcher
|
|
return nil, ErrNoWatcher
|
|
@@ -33,7 +33,7 @@ func WaitEvents(c *clientv3.Client, key string, rev int64, evs []storagepb.Event
|
|
|
|
|
|
|
|
func WaitPrefixEvents(c *clientv3.Client, prefix string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error) {
|
|
func WaitPrefixEvents(c *clientv3.Client, prefix string, rev int64, evs []storagepb.Event_EventType) (*storagepb.Event, error) {
|
|
|
w := clientv3.NewWatcher(c)
|
|
w := clientv3.NewWatcher(c)
|
|
|
- wc := w.WatchPrefix(context.Background(), prefix, rev)
|
|
|
|
|
|
|
+ wc := w.Watch(context.Background(), prefix, clientv3.WithPrefix(), clientv3.WithRev(rev))
|
|
|
if wc == nil {
|
|
if wc == nil {
|
|
|
w.Close()
|
|
w.Close()
|
|
|
return nil, ErrNoWatcher
|
|
return nil, ErrNoWatcher
|