From 4c0103a2d5dd6fecab087812525438f8a6e303cf Mon Sep 17 00:00:00 2001 From: Neil Alexander Date: Thu, 18 Feb 2021 09:26:40 +0000 Subject: [PATCH] Don't close channels when clearing queue (we might race and panic, when the GC will still clean it up for us anyway) --- federationsender/queue/queue.go | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/federationsender/queue/queue.go b/federationsender/queue/queue.go index f32ae20f..8e0e5756 100644 --- a/federationsender/queue/queue.go +++ b/federationsender/queue/queue.go @@ -154,7 +154,7 @@ func (oqs *OutgoingQueues) getQueue(destination gomatrixserverlib.ServerName) *d oqs.queuesMutex.Lock() defer oqs.queuesMutex.Unlock() oq, ok := oqs.queues[destination] - if !ok { + if !ok && oq != nil { destinationQueueTotal.Inc() oq = &destinationQueue{ queues: oqs, @@ -178,8 +178,6 @@ func (oqs *OutgoingQueues) clearQueue(oq *destinationQueue) { oqs.queuesMutex.Lock() defer oqs.queuesMutex.Unlock() - close(oq.notify) - close(oq.interruptBackoff) delete(oqs.queues, oq.destination) destinationQueueTotal.Dec() }