mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
Handling exception: getcdv3.GetConn == nil
This commit is contained in:
parent
8c82f811cb
commit
02c594d4ec
@ -74,7 +74,13 @@ func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string)
|
|||||||
}
|
}
|
||||||
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
||||||
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
reqGetBlackIDListFromCache := &cacheRpc.GetBlackIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := data.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(data.OperationID, errMsg)
|
||||||
|
return true, 0, ""
|
||||||
|
}
|
||||||
|
|
||||||
cacheClient := cacheRpc.NewCacheClient(etcdConn)
|
cacheClient := cacheRpc.NewCacheClient(etcdConn)
|
||||||
cacheResp, err := cacheClient.GetBlackIDListFromCache(context.Background(), reqGetBlackIDListFromCache)
|
cacheResp, err := cacheClient.GetBlackIDListFromCache(context.Background(), reqGetBlackIDListFromCache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -91,7 +97,12 @@ func userRelationshipVerification(data *pbChat.SendMsgReq) (bool, int32, string)
|
|||||||
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
log.NewDebug(data.OperationID, config.Config.MessageVerify.FriendVerify)
|
||||||
if config.Config.MessageVerify.FriendVerify {
|
if config.Config.MessageVerify.FriendVerify {
|
||||||
reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
reqGetFriendIDListFromCache := &cacheRpc.GetFriendIDListFromCacheReq{UserID: data.MsgData.RecvID, OperationID: data.OperationID}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, data.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := data.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(data.OperationID, errMsg)
|
||||||
|
return true, 0, ""
|
||||||
|
}
|
||||||
cacheClient := cacheRpc.NewCacheClient(etcdConn)
|
cacheClient := cacheRpc.NewCacheClient(etcdConn)
|
||||||
cacheResp, err := cacheClient.GetFriendIDListFromCache(context.Background(), reqGetFriendIDListFromCache)
|
cacheResp, err := cacheClient.GetFriendIDListFromCache(context.Background(), reqGetFriendIDListFromCache)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -243,7 +254,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
|
|||||||
return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0)
|
return returnMsg(&replay, pb, int32(callbackResp.ErrCode), callbackResp.ErrMsg, "", 0)
|
||||||
}
|
}
|
||||||
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pb.OperationID, GroupID: pb.MsgData.GroupID}
|
getGroupMemberIDListFromCacheReq := &pbCache.GetGroupMemberIDListFromCacheReq{OperationID: pb.OperationID, GroupID: pb.MsgData.GroupID}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImCacheName, msgToMQSingle.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := msgToMQSingle.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(msgToMQSingle.OperationID, errMsg)
|
||||||
|
return returnMsg(&replay, pb, 201, errMsg, "", 0)
|
||||||
|
}
|
||||||
client := pbCache.NewCacheClient(etcdConn)
|
client := pbCache.NewCacheClient(etcdConn)
|
||||||
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
|
cacheResp, err := client.GetGroupMemberIDListFromCache(context.Background(), getGroupMemberIDListFromCacheReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -351,7 +367,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
|
|||||||
conversationReq.UserIDList = pb.MsgData.AtUserIDList
|
conversationReq.UserIDList = pb.MsgData.AtUserIDList
|
||||||
conversation.GroupAtType = constant.AtMe
|
conversation.GroupAtType = constant.AtMe
|
||||||
}
|
}
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := pb.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(pb.OperationID, errMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
client := pbConversation.NewConversationClient(etcdConn)
|
client := pbConversation.NewConversationClient(etcdConn)
|
||||||
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
|
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -362,7 +383,12 @@ func (rpc *rpcChat) SendMsg(_ context.Context, pb *pbChat.SendMsgReq) (*pbChat.S
|
|||||||
if tag {
|
if tag {
|
||||||
conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList)
|
conversationReq.UserIDList = utils.DifferenceString(atUserID, memberUserIDList)
|
||||||
conversation.GroupAtType = constant.AtAll
|
conversation.GroupAtType = constant.AtAll
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImConversationName, pb.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := pb.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(pb.OperationID, errMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
client := pbConversation.NewConversationClient(etcdConn)
|
client := pbConversation.NewConversationClient(etcdConn)
|
||||||
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
|
conversationReply, err := client.ModifyConversationField(context.Background(), &conversationReq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -794,7 +820,13 @@ func Notification(n *NotificationMsg) {
|
|||||||
offlineInfo.Ex = ex
|
offlineInfo.Ex = ex
|
||||||
msg.OfflinePushInfo = &offlineInfo
|
msg.OfflinePushInfo = &offlineInfo
|
||||||
req.MsgData = &msg
|
req.MsgData = &msg
|
||||||
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName)
|
etcdConn := getcdv3.GetConn(config.Config.Etcd.EtcdSchema, strings.Join(config.Config.Etcd.EtcdAddr, ","), config.Config.RpcRegisterName.OpenImOfflineMessageName, req.OperationID)
|
||||||
|
if etcdConn == nil {
|
||||||
|
errMsg := req.OperationID + "getcdv3.GetConn == nil"
|
||||||
|
log.NewError(req.OperationID, errMsg)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
client := pbChat.NewChatClient(etcdConn)
|
client := pbChat.NewChatClient(etcdConn)
|
||||||
reply, err := client.SendMsg(context.Background(), &req)
|
reply, err := client.SendMsg(context.Background(), &req)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user