mirror of
https://github.com/logos-messaging/go-libp2p-pubsub.git
synced 2026-01-05 06:13:10 +00:00
Merge pull request #72 from libp2p/fix/issue-69
Don't block the event loop because of slow subscriptions
This commit is contained in:
commit
7f3ecddf94
@ -326,7 +326,11 @@ func (p *PubSub) notifySubs(msg *pb.Message) {
|
||||
for _, topic := range msg.GetTopicIDs() {
|
||||
subs := p.myTopics[topic]
|
||||
for f := range subs {
|
||||
f.ch <- &Message{msg}
|
||||
select {
|
||||
case f.ch <- &Message{msg}:
|
||||
default:
|
||||
log.Infof("Can't deliver message to subscription for topic %s; subscriber too slow", topic)
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user