From 5f56cf78bc3e6bbd620246f2273d3636b69089bc Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Tue, 12 Aug 2025 20:28:36 -0400 Subject: [PATCH] Also, unlock before calling Act. This was suggested in a comment for #3588 and seems to work fine without stalls. --- roomserver/internal/input/input.go | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index 18c622ef..7abc6ffd 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -289,10 +289,10 @@ func (w *worker) _next() { // down the subscriber to free up resources. It'll get started // again if new activity happens. w.Lock() - defer w.Unlock() // inside the lock, let's check if the ephemeral consumer saw something new! // If so, we do have new messages after all, they just came at a bad time. if w.ephemeralSeq > w.durableSeq { + w.Unlock(); w.Act(nil, w._next) return } @@ -301,6 +301,7 @@ func (w *worker) _next() { logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID) } w.subscription = nil + w.Unlock() return case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound: w.Lock()