diff --git a/internal/querycoordv2/observers/leader_observer.go b/internal/querycoordv2/observers/leader_observer.go index e51f892217..09da5c9a40 100644 --- a/internal/querycoordv2/observers/leader_observer.go +++ b/internal/querycoordv2/observers/leader_observer.go @@ -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))