mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 12:52:24 +03:00
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 <puttabutta@gmail.com>
This commit is contained in:
parent
5e05f3090b
commit
0e10d89791
1 changed files with 7 additions and 2 deletions
|
@ -289,14 +289,19 @@ func (w *worker) _next() {
|
||||||
// down the subscriber to free up resources. It'll get started
|
// down the subscriber to free up resources. It'll get started
|
||||||
// again if new activity happens.
|
// again if new activity happens.
|
||||||
w.Lock()
|
w.Lock()
|
||||||
|
defer w.Unlock()
|
||||||
// inside the lock, let's check if the ephemeral consumer saw something new!
|
// 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 so, we do have new messages after all, they just came at a bad time.
|
||||||
if w.ephemeralSeq > w.durableSeq {
|
if w.ephemeralSeq > w.durableSeq {
|
||||||
w.Act(nil, w._next)
|
w.Act(nil, w._next)
|
||||||
w.Unlock()
|
|
||||||
return
|
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:
|
case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound:
|
||||||
w.Lock()
|
w.Lock()
|
||||||
defer w.Unlock()
|
defer w.Unlock()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue