mirror of
https://github.com/element-hq/dendrite.git
synced 2025-09-13 21:02:25 +03:00
Also, unlock before calling Act.
This was suggested in a comment for #3588 and seems to work fine without stalls.
This commit is contained in:
parent
0e10d89791
commit
5f56cf78bc
1 changed files with 2 additions and 1 deletions
|
@ -289,10 +289,10 @@ 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.Unlock();
|
||||||
w.Act(nil, w._next)
|
w.Act(nil, w._next)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
@ -301,6 +301,7 @@ func (w *worker) _next() {
|
||||||
logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID)
|
logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID)
|
||||||
}
|
}
|
||||||
w.subscription = nil
|
w.subscription = nil
|
||||||
|
w.Unlock()
|
||||||
return
|
return
|
||||||
case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound:
|
case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound:
|
||||||
w.Lock()
|
w.Lock()
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue