Eliminate busy-loop in dispatchOutbound when context is cancelled
This commit is contained in:
parent
214b201bfa
commit
d7084052b7
1 changed files with 21 additions and 26 deletions
|
|
@ -246,14 +246,10 @@ func (m *Manager) dispatchOutbound(ctx context.Context) {
|
|||
logger.InfoC("channels", "Outbound dispatcher started")
|
||||
|
||||
for {
|
||||
select {
|
||||
case <-ctx.Done():
|
||||
logger.InfoC("channels", "Outbound dispatcher stopped")
|
||||
return
|
||||
default:
|
||||
msg, ok := m.bus.SubscribeOutbound(ctx)
|
||||
if !ok {
|
||||
continue
|
||||
logger.InfoC("channels", "Outbound dispatcher stopped")
|
||||
return
|
||||
}
|
||||
|
||||
// Silently skip internal channels
|
||||
|
|
@ -279,7 +275,6 @@ func (m *Manager) dispatchOutbound(ctx context.Context) {
|
|||
})
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
func (m *Manager) GetChannel(name string) (Channel, bool) {
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue