diff options
author | Neil Alexander <neilalexander@users.noreply.github.com> | 2022-02-07 19:10:01 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-02-07 19:10:01 +0000 |
commit | a572f4db034e13aa38e122d1c4233b15e2356494 (patch) | |
tree | 21438de7478d446e10f6ceb44b166515232a5324 /roomserver/internal/input/input_events.go | |
parent | 908d881a6e2049ab150f58c0697773656fc27a98 (diff) |
Fix bugs that could wedge rooms (#2154)
* Don't flake so badly for rejected events
* Moar
* Fix panic
* Don't count rejected events as missing
* Don't treat rejected events without state as missing
* Revert "Don't count rejected events as missing"
This reverts commit 4b6139b62eb91ba059b47415b0275964b37d9b43.
* Missing events should be KindOld
* If we have state, use it, regardless of memberships which could be stale now
* Fetch missing state for KindOld too
* Tweak the condition again
* Clean up a bit
* Use room updater to get latest events in a race-free way
* Return the correct error
* Improve errors
Diffstat (limited to 'roomserver/internal/input/input_events.go')
-rw-r--r-- | roomserver/internal/input/input_events.go | 14 |
1 files changed, 4 insertions, 10 deletions
diff --git a/roomserver/internal/input/input_events.go b/roomserver/internal/input/input_events.go index 0ca5c31a..85189e47 100644 --- a/roomserver/internal/input/input_events.go +++ b/roomserver/internal/input/input_events.go @@ -297,7 +297,10 @@ func (r *Inputer) processRoomEvent( "soft_fail": softfail, "missing_prev": missingPrev, }).Warn("Stored rejected event") - return commitTransaction, rejectionErr + if rejectionErr != nil { + return commitTransaction, types.RejectedError(rejectionErr.Error()) + } + return commitTransaction, nil } switch input.Kind { @@ -483,16 +486,7 @@ func (r *Inputer) calculateAndSetState( roomState := state.NewStateResolution(updater, roomInfo) if input.HasState { - // Check here if we think we're in the room already. stateAtEvent.Overwrite = true - var joinEventNIDs []types.EventNID - // Request join memberships only for local users only. - if joinEventNIDs, err = updater.GetMembershipEventNIDsForRoom(ctx, roomInfo.RoomNID, true, true); err == nil { - // If we have no local users that are joined to the room then any state about - // the room that we have is quite possibly out of date. Therefore in that case - // we should overwrite it rather than merge it. - stateAtEvent.Overwrite = len(joinEventNIDs) == 0 - } // We've been told what the state at the event is so we don't need to calculate it. // Check that those state events are in the database and store the state. |