Don't close channels when clearing queue (we might race and panic, when the GC will still clean it up for us anyway)

This commit is contained in:
Neil Alexander 2021-02-18 09:26:40 +00:00
parent 2fdc318f2c
commit 4c0103a2d5
No known key found for this signature in database
GPG key ID: A02A2019A2BB0944

View file

@ -154,7 +154,7 @@ func (oqs *OutgoingQueues) getQueue(destination gomatrixserverlib.ServerName) *d
oqs.queuesMutex.Lock() oqs.queuesMutex.Lock()
defer oqs.queuesMutex.Unlock() defer oqs.queuesMutex.Unlock()
oq, ok := oqs.queues[destination] oq, ok := oqs.queues[destination]
if !ok { if !ok && oq != nil {
destinationQueueTotal.Inc() destinationQueueTotal.Inc()
oq = &destinationQueue{ oq = &destinationQueue{
queues: oqs, queues: oqs,
@ -178,8 +178,6 @@ func (oqs *OutgoingQueues) clearQueue(oq *destinationQueue) {
oqs.queuesMutex.Lock() oqs.queuesMutex.Lock()
defer oqs.queuesMutex.Unlock() defer oqs.queuesMutex.Unlock()
close(oq.notify)
close(oq.interruptBackoff)
delete(oqs.queues, oq.destination) delete(oqs.queues, oq.destination)
destinationQueueTotal.Dec() destinationQueueTotal.Dec()
} }