From 995694af7a8ae79bc0616ebfeab063453d5897dd Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Wed, 17 Feb 2021 13:24:31 +0000 Subject: [PATCH] Fix ordering --- federationsender/queue/destinationqueue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federationsender/queue/destinationqueue.go b/federationsender/queue/destinationqueue.go index 96d7783e0..f1f994034 100644 --- a/federationsender/queue/destinationqueue.go +++ b/federationsender/queue/destinationqueue.go @@ -247,6 +247,7 @@ func (oq *destinationQueue) backgroundSend() { } destinationQueueRunning.Inc() defer destinationQueueRunning.Dec() + defer oq.queues.clearQueue(oq.destination) defer oq.running.Store(false) // Mark the queue as overflowed, so we will consult the database @@ -271,7 +272,6 @@ func (oq *destinationQueue) backgroundSend() { // The worker is idle so stop the goroutine. It'll get // restarted automatically the next time we have an event to // send. - oq.queues.clearQueue(oq.destination) return }