fix: harden single-machine load handling
This commit is contained in:
@@ -1348,7 +1348,9 @@ func (t *Topic) saveAndBroadcastMessage(msg *ClientComMessage, asUid types.Uid,
|
||||
if t.cat == types.TopicCatGrp && msg.sess != nil && msg.sess.authLvl != auth.LevelRoot &&
|
||||
store.GroupBusiness != nil && store.Store != nil && store.Store.IsOpen() {
|
||||
access := pud.modeWant & pud.modeGiven
|
||||
started := time.Now()
|
||||
canPost, err := store.GroupBusiness.CanPost(t.tenantID, t.name, asUid, access.IsAdmin(), msg.Timestamp)
|
||||
immetrics.ObserveMessagePublishStage("group", "permission_check", started, err)
|
||||
if err != nil {
|
||||
logs.Warn.Printf("topic[%s]: failed to check group mute policy: %v", t.name, err)
|
||||
msg.sess.queueOut(ErrUnknown(msg.Id, t.original(asUid), msg.Timestamp))
|
||||
@@ -1457,8 +1459,10 @@ func (t *Topic) saveAndBroadcastMessage(msg *ClientComMessage, asUid types.Uid,
|
||||
// Tell the plugins that a message was accepted for delivery
|
||||
pluginMessage(t.tenantID, data.Data, plgActCreate)
|
||||
|
||||
fanoutStarted := time.Now()
|
||||
t.broadcastToSessions(data)
|
||||
publishRealtimeTopicMessage(t.name, data)
|
||||
immetrics.ObserveMessagePublishStage(kind, "realtime_fanout", fanoutStarted, nil)
|
||||
|
||||
// sendPush will update unread message count and send push notification.
|
||||
if pushRcpt := t.pushForData(asUid, data.Data, markedReadBySender); pushRcpt != nil {
|
||||
|
||||
Reference in New Issue
Block a user