Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions internal/msggateway/hub_server.go
Original file line number Diff line number Diff line change
Expand Up @@ -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{
Expand Down
Loading