docker-compose fix

pull/249/head
wangchuxiao 3 years ago
parent bf5bce9e64
commit 6d91f766e7

@ -233,6 +233,27 @@ func (s *friendServer) ImportFriend(ctx context.Context, req *pbFriend.ImportFri
resp.CommonResp.ErrMsg = cacheResp.CommonResp.ErrMsg
return &resp, nil
}
if err := rocksCache.DelAllFriendsInfoFromCache(req.FromUserID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), req.FromUserID)
}
for _, userID := range req.FriendUserIDList {
cacheResp, err := cacheClient.DelFriendIDListFromCache(context.Background(), &pbCache.DelFriendIDListFromCacheReq{UserID: userID, OperationID: req.OperationID})
if err != nil {
log.NewError(req.OperationID, "DelBlackIDListFromCache rpc call failed ", err.Error())
}
if cacheResp != nil && cacheResp.CommonResp != nil {
if cacheResp.CommonResp.ErrCode != 0 {
log.NewError(req.OperationID, "DelBlackIDListFromCache rpc logic call failed ", cacheResp.String())
resp.CommonResp.ErrCode = 500
resp.CommonResp.ErrMsg = cacheResp.CommonResp.ErrMsg
return &resp, nil
}
}
if err := rocksCache.DelAllFriendsInfoFromCache(userID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), err.Error(), userID)
}
}
resp.CommonResp.ErrCode = 0
log.NewInfo(req.OperationID, "ImportFriend rpc ok ", resp.String())
@ -321,6 +342,12 @@ func (s *friendServer) AddFriendResponse(ctx context.Context, req *pbFriend.AddF
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", respPb.CommonResp.String())
return &pbFriend.AddFriendResponseResp{CommonResp: &pbFriend.CommonResp{ErrCode: respPb.CommonResp.ErrCode, ErrMsg: respPb.CommonResp.ErrMsg}}, nil
}
if err := rocksCache.DelAllFriendsInfoFromCache(req.CommID.ToUserID); err != nil {
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.ToUserID)
}
if err := rocksCache.DelAllFriendsInfoFromCache(req.CommID.FromUserID); err != nil {
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID)
}
chat.FriendAddedNotification(req.CommID.OperationID, req.CommID.OpUserID, req.CommID.FromUserID, req.CommID.ToUserID)
}
}
@ -367,6 +394,12 @@ func (s *friendServer) DeleteFriend(ctx context.Context, req *pbFriend.DeleteFri
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), "DelFriendIDListFromCache failed", respPb.CommonResp.String())
return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{ErrCode: respPb.CommonResp.ErrCode, ErrMsg: respPb.CommonResp.ErrMsg}}, nil
}
if err := rocksCache.DelAllFriendsInfoFromCache(req.CommID.FromUserID); err != nil {
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID)
}
if err := rocksCache.DelAllFriendsInfoFromCache(req.CommID.ToUserID); err != nil {
log.NewError(req.CommID.OperationID, utils.GetSelfFuncName(), err.Error(), req.CommID.FromUserID)
}
chat.FriendDeletedNotification(req)
return &pbFriend.DeleteFriendResp{CommonResp: &pbFriend.CommonResp{}}, nil
}

@ -189,6 +189,12 @@ func (s *groupServer) CreateGroup(ctx context.Context, req *pbGroup.CreateGroupR
}
}
for _, userID := range okUserIDList {
if err := rocksCache.DelJoinedGroupIDListFromCache(userID); err != nil {
log.NewError(req.OperationID, utils.GetSelfFuncName(), userID, err.Error())
}
}
if len(okUserIDList) != 0 {
log.NewInfo(req.OperationID, "rpc CreateGroup return ", resp.String())
if req.GroupInfo.GroupType != constant.SuperGroup {

@ -51,7 +51,6 @@ func init() {
}
}
}
}
func GetFriendIDListFromCache(userID string) ([]string, error) {
@ -121,22 +120,6 @@ func DelJoinedGroupIDListFromCache(userID string) error {
return db.DB.Rc.TagAsDeleted(joinedGroupListCache + userID)
}
func GetGroupOwnerFromCache(groupID string) (string, error) {
getGroupOwnerIDList := func() (string, error) {
groupOwner, err := imdb.GetGroupOwnerInfoByGroupID(groupID)
if err != nil {
return "", utils.Wrap(err, "")
}
return groupOwner.UserID, utils.Wrap(err, "")
}
groupOwnerID, err := db.DB.Rc.Fetch(groupOwnerIDCache+groupID, time.Second*30*60, getGroupOwnerIDList)
return groupOwnerID, utils.Wrap(err, "")
}
func DelGroupOwnerListFromCache(groupID string) error {
return db.DB.Rc.TagAsDeleted(groupOwnerIDCache + groupID)
}
func GetGroupMemberIDListFromCache(groupID string) ([]string, error) {
getGroupMemberIDList := func() (string, error) {
groupMemberIDList, err := imdb.GetGroupMemberIDListByGroupID(groupID)
@ -146,7 +129,7 @@ func GetGroupMemberIDListFromCache(groupID string) ([]string, error) {
bytes, err := json.Marshal(groupMemberIDList)
return string(bytes), utils.Wrap(err, "")
}
groupIDListStr, err := db.DB.Rc.Fetch(groupCache+groupID, time.Second*30*60, getGroupMemberIDList)
groupIDListStr, err := db.DB.WeakRc.Fetch(groupCache+groupID, time.Second*30*60, getGroupMemberIDList)
if err != nil {
return nil, utils.Wrap(err, "")
}
@ -156,7 +139,7 @@ func GetGroupMemberIDListFromCache(groupID string) ([]string, error) {
}
func DelGroupMemberIDListFromCache(userID string) error {
err := db.DB.Rc.TagAsDeleted(groupCache + userID)
err := db.DB.WeakRc.TagAsDeleted(groupCache + userID)
return err
}

Loading…
Cancel
Save