mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Merge branch 'errcode' of github.com:OpenIMSDK/Open-IM-Server into errcode
This commit is contained in:
commit
217765be6e
@ -39,6 +39,10 @@ func Start(client discoveryregistry.SvcDiscoveryRegistry, server *grpc.Server) e
|
||||
|
||||
func (s *authServer) UserToken(ctx context.Context, req *pbAuth.UserTokenReq) (*pbAuth.UserTokenResp, error) {
|
||||
log.Info("", "rpc come UserToken")
|
||||
operationID, ok := ctx.Value(constant.OperationID).(string)
|
||||
if !ok {
|
||||
log.Error("2222", "ctx missing operationID", operationID)
|
||||
}
|
||||
resp := pbAuth.UserTokenResp{}
|
||||
if _, err := s.userCheck.GetUserInfo(ctx, req.UserID); err != nil {
|
||||
log.Info("", "UserToken err:", err.Error())
|
||||
|
@ -31,7 +31,7 @@ func Start(rpcPort int, rpcRegisterName string, prometheusPort int, rpcFn func(c
|
||||
return utils.Wrap1(err)
|
||||
}
|
||||
defer zkClient.Close()
|
||||
zkClient.AddOption(grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
zkClient.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()))
|
||||
registerIP, err := network.GetRpcRegisterIP(config.Config.RpcRegisterIP)
|
||||
if err != nil {
|
||||
return err
|
||||
|
@ -45,7 +45,7 @@ func (u *UserGorm) Find(ctx context.Context, userIDs []string) (users []*relatio
|
||||
defer func() {
|
||||
tracelog.SetCtxDebug(ctx, utils.GetFuncName(1), err, "userIDs", userIDs, "users", users)
|
||||
}()
|
||||
err = utils.Wrap(u.DB.Where("user_id in (?)", userIDs).Find(&users).Error, "")
|
||||
err = utils.Wrap(u.DB.Debug().Where("user_id in ?", userIDs).Find(&users).Error, "")
|
||||
return users, err
|
||||
}
|
||||
|
||||
|
@ -41,6 +41,8 @@ func rpcServerInterceptor(ctx context.Context, req interface{}, info *grpc.Unary
|
||||
opUserID = opts[0]
|
||||
}
|
||||
ctx = tracelog.SetFuncInfos(ctx, funcName, operationID)
|
||||
ctx = context.WithValue(ctx, OperationID, operationID)
|
||||
ctx = context.WithValue(ctx, OpUserID, opUserID)
|
||||
tracelog.SetCtxInfo(ctx, funcName, err, "opUserID", opUserID, "rpcReq", rpcString(req))
|
||||
resp, err = handler(ctx, req)
|
||||
if err != nil {
|
||||
@ -58,6 +60,7 @@ func rpcClientInterceptor(ctx context.Context, method string, req, reply interfa
|
||||
}
|
||||
operationID, ok := ctx.Value(constant.OperationID).(string)
|
||||
if !ok {
|
||||
log.Error("1111", "ctx missing operationID")
|
||||
return errs.ErrArgs.Wrap("ctx missing operationID")
|
||||
}
|
||||
md := metadata.Pairs(constant.OperationID, operationID)
|
||||
|
Loading…
x
Reference in New Issue
Block a user