Don't queue in memory for blacklisted destinations

This commit is contained in:
Neil Alexander 2020-12-07 12:36:07 +00:00
parent 558bfa8b06
commit d4bd44ebe6
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -125,6 +125,9 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, receipt *share
log.WithError(err).Errorf("failed to associate EDU with destination %q", oq.destination)
return
}
// Check if the destination is blacklisted. If it isn't then wake
// up the queue.
if !oq.statistics.Blacklisted() {
// If there's room in memory to hold the event then add it to the
// list.
oq.pendingMutex.Lock()
@ -135,9 +138,6 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, receipt *share
})
}
oq.pendingMutex.Unlock()
// Check if the destination is blacklisted. If it isn't then wake
// up the queue.
if !oq.statistics.Blacklisted() {
// Wake up the queue if it's asleep.
oq.wakeQueueIfNeeded()
select {