Eliminate busy-loop in dispatchOutbound when context is cancelled

This commit is contained in:
Yasuhiro Matsumoto 2026-02-16 00:59:09 +09:00
parent 214b201bfa
commit d7084052b7
No known key found for this signature in database
GPG key ID: F2EA90DF2C146D1E

View file

@ -246,14 +246,10 @@ func (m *Manager) dispatchOutbound(ctx context.Context) {
logger.InfoC("channels", "Outbound dispatcher started") logger.InfoC("channels", "Outbound dispatcher started")
for { for {
select {
case <-ctx.Done():
logger.InfoC("channels", "Outbound dispatcher stopped")
return
default:
msg, ok := m.bus.SubscribeOutbound(ctx) msg, ok := m.bus.SubscribeOutbound(ctx)
if !ok { if !ok {
continue logger.InfoC("channels", "Outbound dispatcher stopped")
return
} }
// Silently skip internal channels // Silently skip internal channels
@ -279,7 +275,6 @@ func (m *Manager) dispatchOutbound(ctx context.Context) {
}) })
} }
} }
}
} }
func (m *Manager) GetChannel(name string) (Channel, bool) { func (m *Manager) GetChannel(name string) (Channel, bool) {