Don't block if there are PDUs waiting

This commit is contained in:
Neil Alexander 2020-06-30 14:32:05 +01:00
parent 5082179ce3
commit 51dba37d7a

View file

@ -184,6 +184,7 @@ func (oq *destinationQueue) backgroundSend() {
// Wait either for incoming events, or until we hit an // Wait either for incoming events, or until we hit an
// idle timeout. // idle timeout.
if len(oq.pendingPDUs) == 0 {
select { select {
case <-oq.incomingPDUs: case <-oq.incomingPDUs:
// There are new PDUs waiting in the database. // There are new PDUs waiting in the database.
@ -223,6 +224,7 @@ func (oq *destinationQueue) backgroundSend() {
// get an event. // get an event.
return return
} }
}
// If we are backing off this server then wait for the // If we are backing off this server then wait for the
// backoff duration to complete first, or until explicitly // backoff duration to complete first, or until explicitly