Fix datacoord start timeout (#28026)

Signed-off-by: xiaofan-luan <xiaofan.luan@zilliz.com>
pull/28034/head
Xiaofan 2023-10-31 10:04:12 +08:00 committed by GitHub
parent 2af46d7333
commit 38aa53f523
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 2 deletions

View File

@ -66,8 +66,6 @@ func (kv *etcdKV) GetPath(key string) string {
func (kv *etcdKV) WalkWithPrefix(prefix string, paginationSize int, fn func([]byte, []byte) error) error { func (kv *etcdKV) WalkWithPrefix(prefix string, paginationSize int, fn func([]byte, []byte) error) error {
start := time.Now() start := time.Now()
prefix = path.Join(kv.rootPath, prefix) prefix = path.Join(kv.rootPath, prefix)
ctx, cancel := context.WithTimeout(context.TODO(), RequestTimeout)
defer cancel()
batch := int64(paginationSize) batch := int64(paginationSize)
opts := []clientv3.OpOption{ opts := []clientv3.OpOption{
@ -78,6 +76,8 @@ func (kv *etcdKV) WalkWithPrefix(prefix string, paginationSize int, fn func([]by
key := prefix key := prefix
for { for {
ctx, cancel := context.WithTimeout(context.TODO(), RequestTimeout)
defer cancel()
resp, err := kv.getEtcdMeta(ctx, key, opts...) resp, err := kv.getEtcdMeta(ctx, key, opts...)
if err != nil { if err != nil {
return err return err