Skip to content

Commit

Permalink
Set timeout for leader observer syncing (#27504)
Browse files Browse the repository at this point in the history
Signed-off-by: yah01 <[email protected]>
  • Loading branch information
yah01 authored Oct 8, 2023
1 parent fc429ca commit a715165
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions internal/querycoordv2/observers/leader_observer.go
Original file line number Diff line number Diff line change
Expand Up @@ -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 (
Expand Down Expand Up @@ -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))
Expand Down

0 comments on commit a715165

Please sign in to comment.