Fix ordering

This commit is contained in:
Neil Alexander 2021-02-17 13:24:31 +00:00
parent c2e92d0237
commit 995694af7a
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -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
}