Fix bad merge for prior PR which caused more stalls (#3630)
Some checks are pending
Dendrite / Unit tests (push) Waiting to run
Dendrite / WASM build test (push) Waiting to run
Dendrite / Linting (push) Waiting to run
Dendrite / Build for Linux (push) Waiting to run
Dendrite / Build for Windows (push) Waiting to run
Dendrite / Initial tests passed (push) Blocked by required conditions
Dendrite / Integration tests (push) Blocked by required conditions
Dendrite / Upgrade tests (push) Blocked by required conditions
Dendrite / Upgrade tests from HEAD-2 (push) Blocked by required conditions
Dendrite / Sytest (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Sytest (SQLite native) (push) Blocked by required conditions
Dendrite / Complement (PostgreSQL) (push) Blocked by required conditions
Dendrite / Complement (SQLite native) (push) Blocked by required conditions
Dendrite / Sytest (PostgreSQL) (push) Blocked by required conditions
Dendrite / Update Docker images (push) Blocked by required conditions
Dendrite / Complement (SQLite Cgo) (push) Blocked by required conditions
Dendrite / Integration tests passed (push) Blocked by required conditions

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 <puttabutta@gmail.com>`

---------

Signed-off-by: Vivianne Langdon <puttabutta@gmail.com>
This commit is contained in:
Vivianne 2025-08-13 05:53:33 -04:00 committed by GitHub
parent 5e05f3090b
commit 0945374736
No known key found for this signature in database
GPG key ID: B5690EEEBB952194

View file

@ -292,11 +292,17 @@ func (w *worker) _next() {
// 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.Unlock() w.Unlock()
w.Act(nil, w._next)
return return
} }
if err = w.subscription.Unsubscribe(); err != nil {
logrus.WithError(err).Errorf("Failed to unsubscribe to stream for room %q", w.roomID)
}
w.subscription = nil
w.Unlock() w.Unlock()
return
case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound: case nats.ErrConsumerDeleted, nats.ErrConsumerNotFound:
w.Lock() w.Lock()
defer w.Unlock() defer w.Unlock()