Set timeout for leader observer syncing (#27504)

Signed-off-by: yah01 <yah2er0ne@outlook.com>
pull/27531/head
yah01 2023-10-08 16:55:31 +08:00 committed by GitHub
parent fc429cabba
commit a715165306
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 3 additions and 0 deletions

View File

@ -31,6 +31,7 @@ import (
"github.com/milvus-io/milvus/internal/querycoordv2/utils"
"github.com/milvus-io/milvus/pkg/log"
"github.com/milvus-io/milvus/pkg/util/commonpbutil"
"github.com/milvus-io/milvus/pkg/util/paramtable"
)
const (
@ -281,6 +282,8 @@ func (o *LeaderObserver) sync(ctx context.Context, replicaID int64, leaderView *
},
Version: time.Now().UnixNano(),
}
ctx, cancel := context.WithTimeout(ctx, paramtable.Get().QueryCoordCfg.SegmentTaskTimeout.GetAsDuration(time.Millisecond))
defer cancel()
resp, err := o.cluster.SyncDistribution(ctx, leaderView.ID, req)
if err != nil {
log.Warn("failed to sync distribution", zap.Error(err))