Browse Source

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

pull/6853/head
Sam Kleinman 3 years ago
committed by GitHub
parent
commit
39dee8abc5
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 4 additions and 1 deletions
  1. +4
    -1
      libs/pubsub/pubsub.go

+ 4
- 1
libs/pubsub/pubsub.go 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 {


Loading…
Cancel
Save