Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Don't pull out the full state of the room when handling new events. #12684

@erikjohnston

Description

@erikjohnston

Currently when we calculate the state group for a new event we always fetch the full state from the DB, even when no state resolution happens. This is then stored in the EventContext, which is access via context.get_prev_state_ids() and get_current_state_ids().

Historically, we needed to store the state in EventContext as we may not have persisted it yet. However, nowadays we always store the state group for the new event before we create EventContext, so we can rely on being able to fetch the state from the DB.

I suggest we:

  • Remove the cached state from EventContext and instead fetch state from the DB each time (relying on the caching to minimise performance problems)
  • Ensure the state handler doesn't fetch the full state from the DB when there are no conflicts
  • Change the EventContext methods to accept a StateFilter and use those everywhere.

Metadata

Metadata

Assignees

Labels

T-TaskRefactoring, removal, replacement, enabling or disabling functionality, other engineering tasks.

Type

No type

Projects

No projects

Relationships

None yet

Development

No branches or pull requests

Issue actions