Don't overflow for blacklisted servers

This commit is contained in:
Till Faelligen 2022-10-21 11:15:14 +02:00
parent 1518087d0a
commit d321a13123
No known key found for this signature in database
GPG key ID: 3DF82D8AB9211D4E
2 changed files with 28 additions and 39 deletions

View file

@ -76,9 +76,6 @@ func (oq *destinationQueue) sendEvent(event *gomatrixserverlib.HeaderedEvent, re
return 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 // If there's room in memory to hold the event then add it to the
// list. // list.
oq.pendingMutex.Lock() oq.pendingMutex.Lock()
@ -95,9 +92,6 @@ func (oq *destinationQueue) sendEvent(event *gomatrixserverlib.HeaderedEvent, re
if !oq.backingOff.Load() { if !oq.backingOff.Load() {
oq.wakeQueueAndNotify() oq.wakeQueueAndNotify()
} }
} else {
oq.overflowed.Store(true)
}
} }
// sendEDU adds the EDU event to the pending queue for the destination. // sendEDU adds the EDU event to the pending queue for the destination.
@ -108,9 +102,7 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, receipt *share
logrus.Errorf("attempt to send nil EDU with destination %q", oq.destination) logrus.Errorf("attempt to send nil EDU with destination %q", oq.destination)
return 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 // If there's room in memory to hold the event then add it to the
// list. // list.
oq.pendingMutex.Lock() oq.pendingMutex.Lock()
@ -127,9 +119,6 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, receipt *share
if !oq.backingOff.Load() { if !oq.backingOff.Load() {
oq.wakeQueueAndNotify() oq.wakeQueueAndNotify()
} }
} else {
oq.overflowed.Store(true)
}
} }
// handleBackoffNotifier is registered as the backoff notification // handleBackoffNotifier is registered as the backoff notification

View file

@ -248,7 +248,7 @@ func (oqs *OutgoingQueues) SendEvent(
} }
for destination := range destmap { for destination := range destmap {
if queue := oqs.getQueue(destination); queue != nil { if queue := oqs.getQueue(destination); queue != nil && !queue.statistics.Blacklisted() {
queue.sendEvent(ev, nid) queue.sendEvent(ev, nid)
} else { } else {
delete(destmap, destination) delete(destmap, destination)
@ -336,7 +336,7 @@ func (oqs *OutgoingQueues) SendEDU(
} }
for destination := range destmap { for destination := range destmap {
if queue := oqs.getQueue(destination); queue != nil { if queue := oqs.getQueue(destination); queue != nil && !queue.statistics.Blacklisted() {
queue.sendEDU(e, nid) queue.sendEDU(e, nid)
} else { } else {
delete(destmap, destination) delete(destmap, destination)