Browse Source

p2p: avoid blocking on the dequeCh (#6765)

pull/6767/head
Callum Waters 3 years ago
committed by GitHub
parent
commit
a341a626e0
No known key found for this signature in database GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 5 additions and 1 deletions
  1. +5
    -1
      internal/p2p/pqueue.go

+ 5
- 1
internal/p2p/pqueue.go View File

@ -257,7 +257,11 @@ func (s *pqScheduler) process() {
s.metrics.PeerSendBytesTotal.With( s.metrics.PeerSendBytesTotal.With(
"chID", chIDStr, "chID", chIDStr,
"peer_id", string(pqEnv.envelope.To)).Add(float64(pqEnv.size)) "peer_id", string(pqEnv.envelope.To)).Add(float64(pqEnv.size))
s.dequeueCh <- pqEnv.envelope
select {
case s.dequeueCh <- pqEnv.envelope:
case <-s.closer.Done():
return
}
} }
case <-s.closer.Done(): case <-s.closer.Done():


Loading…
Cancel
Save