pubsub: improve handling of closed blocking subsciptions. (#6852)

This commit is contained in:
Sam Kleinman
2021-08-23 16:41:45 -04:00
committed by GitHub
parent d0e33b4292
commit 39dee8abc5

View File

@@ -507,7 +507,10 @@ func (state *state) send(msg interface{}, events []types.Event) error {
for clientID, subscription := range clientSubscriptions {
if cap(subscription.out) == 0 {
// block on unbuffered channel
subscription.out <- NewMessage(subscription.id, msg, events)
select {
case subscription.out <- NewMessage(subscription.id, msg, events):
case <-subscription.canceled:
}
} else {
// don't block on buffered channels
select {