diff --git a/federationsender/queue/destinationqueue.go b/federationsender/queue/destinationqueue.go index 70cac5ed6..7dbffbf0d 100644 --- a/federationsender/queue/destinationqueue.go +++ b/federationsender/queue/destinationqueue.go @@ -246,6 +246,14 @@ func (oq *destinationQueue) backgroundSend() { // has exceeded a maximum allowable value. Clean up the in-memory // buffers at this point. The PDU clean-up is already on a defer. log.Warnf("Blacklisting %q due to exceeding backoff threshold", oq.destination) + for i := pendingPDUs { + pendingPDUs[i] = nil + } + for i := pendingEDUs { + pendingEDUs[i] = nil + } + pendingPDUs = nil + pendingEDUs = nil return } if until != nil && until.After(time.Now()) { @@ -269,6 +277,12 @@ func (oq *destinationQueue) backgroundSend() { // If we successfully sent the transaction then clear out // the pending events and EDUs, and wipe our transaction ID. oq.statistics.Success() + for i := pendingPDUs { + pendingPDUs[i] = nil + } + for i := pendingEDUs { + pendingEDUs[i] = nil + } pendingPDUs = pendingPDUs[:0] pendingEDUs = pendingEDUs[:0] }