Clean up better

This commit is contained in:
Neil Alexander 2020-12-04 16:23:58 +00:00
parent bfcf1307e8
commit 44187311b6
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

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