From 0e10d8979187721c21ac4046be9845e6f3e1db15 Mon Sep 17 00:00:00 2001 From: Vivianne Langdon Date: Tue, 12 Aug 2025 19:36:57 -0400 Subject: [PATCH] bugfix: don't try to process messages if we timeout Due to a bad merge, timeouts were not early-returning and so could cause a stall in the roomserver. Fix the bad merge and early-out. Signed-off-by: Vivianne Langdon --- roomserver/internal/input/input.go | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/roomserver/internal/input/input.go b/roomserver/internal/input/input.go index 232f4feb..18c622ef 100644 --- a/roomserver/internal/input/input.go +++ b/roomserver/internal/input/input.go @@ -289,14 +289,19 @@ 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.Act(nil, w._next) - w.Unlock() return } - w.Unlock() + + if err = w.subscription.Unsubscribe(); err != nil { + logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID) + } + w.subscription = nil + return case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound: w.Lock() defer w.Unlock()