From b15b5c7f0d1a618a8bc4ee393cbe9b6b2019d9d6 Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Fri, 3 Apr 2020 10:32:47 +0100 Subject: [PATCH] Tweak order in destinationQueue.next --- federationsender/queue/destinationqueue.go | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/federationsender/queue/destinationqueue.go b/federationsender/queue/destinationqueue.go index b9578d247..9b3f749c0 100644 --- a/federationsender/queue/destinationqueue.go +++ b/federationsender/queue/destinationqueue.go @@ -112,6 +112,11 @@ func (oq *destinationQueue) next() *gomatrixserverlib.Transaction { oq.runningMutex.Lock() defer oq.runningMutex.Unlock() + if len(oq.pendingEvents) == 0 && len(oq.pendingEDUs) == 0 && len(oq.pendingInvites) == 0 { + oq.running = false + return nil + } + if len(oq.pendingInvites) > 0 { for _, inviteReq := range oq.pendingInvites { ev := inviteReq.Event() @@ -131,11 +136,6 @@ func (oq *destinationQueue) next() *gomatrixserverlib.Transaction { oq.pendingInvites = oq.pendingInvites[:0] } - if len(oq.pendingEvents) == 0 && len(oq.pendingEDUs) == 0 { - oq.running = false - return nil - } - t := gomatrixserverlib.Transaction{ PDUs: []json.RawMessage{}, EDUs: []gomatrixserverlib.EDU{},