From 147b3eddadd9443c0fd4c0b2d7df574f5117547c Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Mon, 7 Dec 2020 12:58:36 +0000 Subject: [PATCH] Fix a couple of bugs --- federationsender/queue/destinationqueue.go | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/federationsender/queue/destinationqueue.go b/federationsender/queue/destinationqueue.go index f086009f0..12845061a 100644 --- a/federationsender/queue/destinationqueue.go +++ b/federationsender/queue/destinationqueue.go @@ -95,6 +95,8 @@ func (oq *destinationQueue) sendEvent(event *gomatrixserverlib.HeaderedEvent, re pdu: event, receipt: receipt, }) + } else { + oq.overflowed.Store(true) } oq.pendingMutex.Unlock() // Wake up the queue if it's asleep. @@ -136,6 +138,8 @@ func (oq *destinationQueue) sendEDU(event *gomatrixserverlib.EDU, receipt *share edu: event, receipt: receipt, }) + } else { + oq.overflowed.Store(true) } oq.pendingMutex.Unlock() // Wake up the queue if it's asleep. @@ -302,10 +306,10 @@ func (oq *destinationQueue) backgroundSend() { // the pending events and EDUs, and wipe our transaction ID. oq.statistics.Success() oq.pendingMutex.Lock() - for i := range oq.pendingPDUs { + for i := range oq.pendingPDUs[:pc] { oq.pendingPDUs[i] = nil } - for i := range oq.pendingEDUs { + for i := range oq.pendingEDUs[:ec] { oq.pendingEDUs[i] = nil } oq.pendingPDUs = oq.pendingPDUs[pc:]