Skip to content

Commit 0945374

Browse files
authored
Fix bad merge for prior PR which caused more stalls (#3630)
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. Minor fix to a bad merge of my change for #3484 This also incorporates a suggested tweak to the prior PR #3588 to avoid holding the lock unnecessarily. ### Pull Request Checklist <!-- Please read https://matrix-org.github.io/dendrite/development/contributing before submitting your pull request --> * [x] I have added Go unit tests or [Complement integration tests](https://github.com/matrix-org/complement) for this PR _or_ I have justified why this PR doesn't need tests * [x] Pull request includes a [sign off below](https://element-hq.github.io/dendrite/development/contributing#sign-off) _or_ I have already signed off privately Signed-off-by: `Vivianne Langdon <[email protected]>` --------- Signed-off-by: Vivianne Langdon <[email protected]>
1 parent 5e05f30 commit 0945374

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

roomserver/internal/input/input.go

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -292,11 +292,17 @@ func (w *worker) _next() {
292292
// inside the lock, let's check if the ephemeral consumer saw something new!
293293
// If so, we do have new messages after all, they just came at a bad time.
294294
if w.ephemeralSeq > w.durableSeq {
295-
w.Act(nil, w._next)
296295
w.Unlock()
296+
w.Act(nil, w._next)
297297
return
298298
}
299+
300+
if err = w.subscription.Unsubscribe(); err != nil {
301+
logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID)
302+
}
303+
w.subscription = nil
299304
w.Unlock()
305+
return
300306
case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound:
301307
w.Lock()
302308
defer w.Unlock()

0 commit comments

Comments
 (0)