clientv3/namespace: fix incorrect watching prefix-end

using "abc" will watch the wrong range when WithPrefix() specified.
This commit is contained in:
darasion
2017-04-15 22:31:50 +08:00
parent e2d0db95eb
commit 0e7fd4a37c
2 changed files with 2 additions and 2 deletions

View File

@ -40,7 +40,7 @@ func NewWatcher(w clientv3.Watcher, prefix string) clientv3.Watcher {
func (w *watcherPrefix) Watch(ctx context.Context, key string, opts ...clientv3.OpOption) clientv3.WatchChan {
// since OpOption is opaque, determine range for prefixing through an OpGet
op := clientv3.OpGet("abc", opts...)
op := clientv3.OpGet(key, opts...)
end := op.RangeBytes()
pfxBegin, pfxEnd := prefixInterval(w.pfx, []byte(key), end)
if pfxEnd != nil {