mirror of
https://github.com/YspCoder/clawgo.git
synced 2026-05-20 23:57:30 +08:00
perf: implement concurrent outbound message dispatching in channel manager
This commit is contained in:
@@ -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)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user