mirror of
https://github.com/openimsdk/open-im-server.git
synced 2025-04-06 04:15:46 +08:00
fix duplicated offline push (#1816)
This commit is contained in:
parent
1d5732c97e
commit
b14c0475d2
@ -118,18 +118,25 @@ func (p *Pusher) Push2User(ctx context.Context, userIDs []string, msg *sdkws.Msg
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, v := range wsResults {
|
if len(wsResults) == 0 {
|
||||||
if !v.OnlinePush && msg.SendID == v.UserID {
|
return nil
|
||||||
if err = callbackOfflinePush(ctx, userIDs, msg, &[]string{}); err != nil {
|
}
|
||||||
return err
|
onlinePushSuccUserIDSet := utils.SliceSet(utils.Filter(wsResults, func(e *msggateway.SingleMsgToUserResults) (string, bool) {
|
||||||
}
|
return e.UserID, e.OnlinePush && e.UserID != ""
|
||||||
|
}))
|
||||||
|
offlinePushUserIDList := utils.Filter(wsResults, func(e *msggateway.SingleMsgToUserResults) (string, bool) {
|
||||||
|
_, exist := onlinePushSuccUserIDSet[e.UserID]
|
||||||
|
return e.UserID, !exist && e.UserID != "" && e.UserID != msg.SendID
|
||||||
|
})
|
||||||
|
|
||||||
err = p.offlinePushMsg(ctx, msg.SendID, msg, []string{v.UserID})
|
if len(offlinePushUserIDList) > 0 {
|
||||||
if err != nil {
|
if err = callbackOfflinePush(ctx, offlinePushUserIDList, msg, &[]string{}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
err = p.offlinePushMsg(ctx, msg.SendID, msg, offlinePushUserIDList)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user