mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-12-02 18:34:29 +08:00
fix: fix the err2
This commit is contained in:
parent
62134aa6fc
commit
f9116744e2
@ -71,7 +71,7 @@ func StartTransfer(config *config.GlobalConfig, prometheusPort int) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err2 := client.CreateRpcRootNodes(config.GetServiceNames()); err2 != nil {
|
if err := client.CreateRpcRootNodes(config.GetServiceNames()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))
|
client.AddOption(mw.GrpcClient(), grpc.WithTransportCredentials(insecure.NewCredentials()), grpc.WithDefaultServiceConfig(fmt.Sprintf(`{"LoadBalancingPolicy": "%s"}`, "round_robin")))
|
||||||
|
|||||||
@ -92,9 +92,9 @@ func (g *Client) Push(ctx context.Context, userIDs []string, title, content stri
|
|||||||
for i, v := range s.GetSplitResult() {
|
for i, v := range s.GetSplitResult() {
|
||||||
go func(index int, userIDs []string) {
|
go func(index int, userIDs []string) {
|
||||||
defer wg.Done()
|
defer wg.Done()
|
||||||
if err2 := g.batchPush(ctx, token, userIDs, pushReq); err2 != nil {
|
if err := g.batchPush(ctx, token, userIDs, pushReq); err != nil {
|
||||||
log.ZError(ctx, "batchPush failed", err2, "index", index, "token", token, "req", pushReq)
|
log.ZError(ctx, "batchPush failed", err, "index", index, "token", token, "req", pushReq)
|
||||||
err = err2
|
err = err
|
||||||
}
|
}
|
||||||
}(i, v.Item)
|
}(i, v.Item)
|
||||||
}
|
}
|
||||||
|
|||||||
16
pkg/common/db/cache/user.go
vendored
16
pkg/common/db/cache/user.go
vendored
@ -201,13 +201,13 @@ func (u *UserCacheRedis) SetUserStatus(ctx context.Context, userID string, statu
|
|||||||
Status: constant.Online,
|
Status: constant.Online,
|
||||||
PlatformIDs: []int32{platformID},
|
PlatformIDs: []int32{platformID},
|
||||||
}
|
}
|
||||||
jsonData, err2 := json.Marshal(&onlineStatus)
|
jsonData, err := json.Marshal(&onlineStatus)
|
||||||
if err2 != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err2)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
_, err2 = u.rdb.HSet(ctx, key, userID, string(jsonData)).Result()
|
_, err = u.rdb.HSet(ctx, key, userID, string(jsonData)).Result()
|
||||||
if err2 != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err2)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
u.rdb.Expire(ctx, key, userOlineStatusExpireTime)
|
u.rdb.Expire(ctx, key, userOlineStatusExpireTime)
|
||||||
|
|
||||||
@ -281,9 +281,9 @@ func (u *UserCacheRedis) refreshStatusOffline(ctx context.Context, userID string
|
|||||||
func (u *UserCacheRedis) refreshStatusOnline(ctx context.Context, userID string, platformID int32, isNil bool, err error, result, key string) error {
|
func (u *UserCacheRedis) refreshStatusOnline(ctx context.Context, userID string, platformID int32, isNil bool, err error, result, key string) error {
|
||||||
var onlineStatus user.OnlineStatus
|
var onlineStatus user.OnlineStatus
|
||||||
if !isNil {
|
if !isNil {
|
||||||
err2 := json.Unmarshal([]byte(result), &onlineStatus)
|
err := json.Unmarshal([]byte(result), &onlineStatus)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return errs.Wrap(err2)
|
return errs.Wrap(err)
|
||||||
}
|
}
|
||||||
onlineStatus.PlatformIDs = RemoveRepeatedElementsInList(append(onlineStatus.PlatformIDs, platformID))
|
onlineStatus.PlatformIDs = RemoveRepeatedElementsInList(append(onlineStatus.PlatformIDs, platformID))
|
||||||
} else {
|
} else {
|
||||||
|
|||||||
@ -420,9 +420,9 @@ func (db *commonMsgDatabase) BatchInsertChat2Cache(ctx context.Context, conversa
|
|||||||
log.ZError(ctx, "db.cache.SetMaxSeq error", err, "conversationID", conversationID)
|
log.ZError(ctx, "db.cache.SetMaxSeq error", err, "conversationID", conversationID)
|
||||||
prommetrics.SeqSetFailedCounter.Inc()
|
prommetrics.SeqSetFailedCounter.Inc()
|
||||||
}
|
}
|
||||||
err2 := db.cache.SetHasReadSeqs(ctx, conversationID, userSeqMap)
|
err = db.cache.SetHasReadSeqs(ctx, conversationID, userSeqMap)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.ZError(ctx, "SetHasReadSeqs error", err2, "userSeqMap", userSeqMap, "conversationID", conversationID)
|
log.ZError(ctx, "SetHasReadSeqs error", err, "userSeqMap", userSeqMap, "conversationID", conversationID)
|
||||||
prommetrics.SeqSetFailedCounter.Inc()
|
prommetrics.SeqSetFailedCounter.Inc()
|
||||||
}
|
}
|
||||||
return lastMaxSeq, isNew, errs.Wrap(err)
|
return lastMaxSeq, isNew, errs.Wrap(err)
|
||||||
|
|||||||
@ -265,11 +265,11 @@ func (g *GroupNotificationSender) fillOpUser(ctx context.Context, opUser **sdkws
|
|||||||
AppMangerLevel: constant.AppAdmin,
|
AppMangerLevel: constant.AppAdmin,
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
member, err2 := g.db.TakeGroupMember(ctx, groupID, userID)
|
member, err := g.db.TakeGroupMember(ctx, groupID, userID)
|
||||||
if err2 == nil {
|
if err == nil {
|
||||||
*opUser = g.groupMemberDB2PB(member, 0)
|
*opUser = g.groupMemberDB2PB(member, 0)
|
||||||
} else if !errs.ErrRecordNotFound.Is(err2) {
|
} else if !errs.ErrRecordNotFound.Is(err) {
|
||||||
return err2
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user