From 1f723362c0d4d30d5968b0b37bb6b85f94d3efe9 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:38:50 +0200 Subject: [PATCH 1/2] Don't attempt to send transactions if Dendrite is shutting down --- federationapi/queue/destinationqueue.go | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/federationapi/queue/destinationqueue.go b/federationapi/queue/destinationqueue.go index f51e849fa3..118e3df977 100644 --- a/federationapi/queue/destinationqueue.go +++ b/federationapi/queue/destinationqueue.go @@ -294,6 +294,10 @@ func (oq *destinationQueue) checkNotificationsOnClose() { // backgroundSend is the worker goroutine for sending events. func (oq *destinationQueue) backgroundSend() { + // Don't try to send transactions if we are shutting down. + if oq.process.Context() != nil { + return + } // Check if a worker is already running, and if it isn't, then // mark it as started. if !oq.running.CompareAndSwap(false, true) { From 43ac98dfbe794d998bb7fe14b13498f9af500011 Mon Sep 17 00:00:00 2001 From: Till Faelligen <2353100+S7evinK@users.noreply.github.com> Date: Mon, 8 Apr 2024 20:50:48 +0200 Subject: [PATCH 2/2] Err()... --- federationapi/queue/destinationqueue.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/federationapi/queue/destinationqueue.go b/federationapi/queue/destinationqueue.go index 118e3df977..87a6fe5595 100644 --- a/federationapi/queue/destinationqueue.go +++ b/federationapi/queue/destinationqueue.go @@ -295,7 +295,7 @@ func (oq *destinationQueue) checkNotificationsOnClose() { // backgroundSend is the worker goroutine for sending events. func (oq *destinationQueue) backgroundSend() { // Don't try to send transactions if we are shutting down. - if oq.process.Context() != nil { + if oq.process.Context().Err() != nil { return } // Check if a worker is already running, and if it isn't, then