fix: Fix frequent 'failed to get request info' log (#33334)

issue: https://github.com/milvus-io/milvus/issues/33333

---------

Signed-off-by: bigsheeper <yihao.dai@zilliz.com>
This commit is contained in:
yihao.dai 2024-05-27 14:27:41 +08:00 committed by GitHub
parent ee73e62202
commit af71116499
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 3 additions and 3 deletions

View File

@ -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) {
dbID, collectionIDToPartIDs, rt, n, err := getRequestInfo(ctx, req)
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)
}
@ -205,7 +205,7 @@ func getRequestInfo(ctx context.Context, req interface{}) (int64, map[int64][]in
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("unsupported request type %T", req)
return util.InvalidDBID, map[int64][]int64{}, 0, 0, nil
}
}

View File

@ -261,7 +261,7 @@ func TestRateLimitInterceptor(t *testing.T) {
assert.Error(t, err)
_, _, _, _, err = getRequestInfo(context.Background(), &milvuspb.CalcDistanceRequest{})
assert.Error(t, err)
assert.NoError(t, err)
})
t.Run("test getFailedResponse", func(t *testing.T) {