mirror of https://github.com/milvus-io/milvus.git
issue: issue: https://github.com/milvus-io/milvus/issues/33333 pr: https://github.com/milvus-io/milvus/pull/33334 Signed-off-by: bigsheeper <yihao.dai@zilliz.com>pull/33391/head
parent
aaecc92244
commit
b205d7e29f
|
@ -41,7 +41,7 @@ func RateLimitInterceptor(limiter types.Limiter) grpc.UnaryServerInterceptor {
|
||||||
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
return func(ctx context.Context, req any, info *grpc.UnaryServerInfo, handler grpc.UnaryHandler) (interface{}, error) {
|
||||||
dbID, collectionIDToPartIDs, rt, n, err := getRequestInfo(ctx, req)
|
dbID, collectionIDToPartIDs, rt, n, err := getRequestInfo(ctx, req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.RatedWarn(10, "failed to get request info", zap.Error(err))
|
log.Warn("failed to get request info", zap.Error(err))
|
||||||
return handler(ctx, req)
|
return handler(ctx, req)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -205,7 +205,7 @@ func getRequestInfo(ctx context.Context, req interface{}) (int64, map[int64][]in
|
||||||
if req == nil {
|
if req == nil {
|
||||||
return util.InvalidDBID, map[int64][]int64{}, 0, 0, fmt.Errorf("null request")
|
return util.InvalidDBID, map[int64][]int64{}, 0, 0, fmt.Errorf("null request")
|
||||||
}
|
}
|
||||||
return util.InvalidDBID, map[int64][]int64{}, 0, 0, fmt.Errorf("unsupported request type %T", req)
|
return util.InvalidDBID, map[int64][]int64{}, 0, 0, nil
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -257,7 +257,7 @@ func TestRateLimitInterceptor(t *testing.T) {
|
||||||
assert.Error(t, err)
|
assert.Error(t, err)
|
||||||
|
|
||||||
_, _, _, _, err = getRequestInfo(context.Background(), &milvuspb.CalcDistanceRequest{})
|
_, _, _, _, err = getRequestInfo(context.Background(), &milvuspb.CalcDistanceRequest{})
|
||||||
assert.Error(t, err)
|
assert.NoError(t, err)
|
||||||
})
|
})
|
||||||
|
|
||||||
t.Run("test getFailedResponse", func(t *testing.T) {
|
t.Run("test getFailedResponse", func(t *testing.T) {
|
||||||
|
|
Loading…
Reference in New Issue