Skip to content

Commit

Permalink
review comments
Browse files Browse the repository at this point in the history
Signed-off-by: rishabh_mittal <mittalrishabh@gmail.com>
  • Loading branch information
mittalrishabh committed Aug 18, 2023
1 parent e4117f1 commit 46cec29
Showing 1 changed file with 13 additions and 7 deletions.
20 changes: 13 additions & 7 deletions server/grpc_service.go
Original file line number Diff line number Diff line change
Expand Up @@ -1620,13 +1620,19 @@ func (s *GrpcServer) ScatterRegion(ctx context.Context, request *pdpb.ScatterReg
if err != nil {
return nil, err
}
if op != nil {
if op != nil && !rc.GetOperatorController().AddOperator(op) {
return &pdpb.ScatterRegionResponse{
Header: s.wrapErrorToHeader(pdpb.ErrorType_UNKNOWN,
"operator cancelled because store limit exceeded"),
}, nil
}

if op == nil {
return &pdpb.ScatterRegionResponse{
Header: s.wrapErrorToHeader(pdpb.ErrorType_UNKNOWN,
"operator could not be allocated"),
}, nil
}

if !rc.GetOperatorController().AddOperator(op) {
return &pdpb.ScatterRegionResponse{
Header: s.wrapErrorToHeader(pdpb.ErrorType_UNKNOWN,
"operator cancelled because store limit exceeded"),
}, nil
}

return &pdpb.ScatterRegionResponse{
Expand Down

0 comments on commit 46cec29

Please sign in to comment.