perf: implement concurrent outbound message dispatching in channel manager

This commit is contained in:
DBT
2026-02-12 05:32:09 +00:00
parent 11c38f8320
commit 9dc73616d6

View File

@@ -227,12 +227,15 @@ func (m *Manager) dispatchOutbound(ctx context.Context) {
continue continue
} }
if err := channel.Send(ctx, msg); err != nil { // 使用 goroutine 实现并发消息分发,避免单个通道延迟阻塞全局 dispatcher
logger.ErrorCF("channels", "Error sending message to channel", map[string]interface{}{ go func(c Channel, m bus.OutboundMessage) {
"channel": msg.Channel, if err := c.Send(ctx, m); err != nil {
"error": err.Error(), logger.ErrorCF("channels", "Error sending message to channel", map[string]interface{}{
}) "channel": m.Channel,
} "error": err.Error(),
})
}
}(channel, msg)
} }
} }
} }