mirror of
https://github.com/openimsdk/open-im-server.git
synced 2026-09-04 22:53:17 +08:00
Merge badf05f6b153ebe2d7c226e9b2d0665df74bb0ba into 175a7bb0673eca18e9d1b10bff4f728da6b1b513
This commit is contained in:
commit
967a35fb67
@ -175,22 +175,22 @@ func (s *Server) SuperGroupOnlineBatchPushOneMsg(ctx context.Context, req *msgga
|
||||
ch := make(chan *msggateway.SingleMsgToUserResults, len(req.PushToUserIDs))
|
||||
var count atomic.Int64
|
||||
count.Add(int64(len(req.PushToUserIDs)))
|
||||
pushResult := func(result *msggateway.SingleMsgToUserResults) {
|
||||
ch <- result
|
||||
if count.Add(-1) == 0 {
|
||||
close(ch)
|
||||
}
|
||||
}
|
||||
for i := range req.PushToUserIDs {
|
||||
userID := req.PushToUserIDs[i]
|
||||
err := s.queue.PushCtx(ctx, func() {
|
||||
ch <- s.pushToUser(ctx, userID, req.MsgData)
|
||||
if count.Add(-1) == 0 {
|
||||
close(ch)
|
||||
}
|
||||
pushResult(s.pushToUser(ctx, userID, req.MsgData))
|
||||
})
|
||||
if err != nil {
|
||||
if count.Add(-1) == 0 {
|
||||
close(ch)
|
||||
}
|
||||
log.ZError(ctx, "pushToUser MemoryQueue failed", err, "userID", userID)
|
||||
ch <- &msggateway.SingleMsgToUserResults{
|
||||
pushResult(&msggateway.SingleMsgToUserResults{
|
||||
UserID: userID,
|
||||
}
|
||||
})
|
||||
}
|
||||
}
|
||||
resp := &msggateway.OnlineBatchPushOneMsgResp{
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user