Drop announce messages to peers when their buffer is full

This commit is contained in:
Garrett Thornburg 2017-09-01 23:10:06 -04:00
parent 63c977c815
commit 2ac19f2157
1 changed files with 6 additions and 2 deletions

View File

@ -230,8 +230,12 @@ func (p *PubSub) announce(topic string, sub bool) {
}
out := rpcWithSubs(subopt)
for _, peer := range p.peers {
peer <- out
for pid, peer := range p.peers {
select {
case peer <- out:
default:
log.Infof("dropping announce message to peer %s: queue full", pid)
}
}
}