element-hq / element-hq/synapse
`filter_events_for_server` takes a lot of DB time, and is wrong for state events
- Dominant language
- Python
- Stars
- 4.6k
- Forks
- 600
- Avg merge
- 5d 22h
- Merged PRs (30d)
- 51
Description
This issue has been migrated from [#4094](https://github.com/matrix-org/synapse/issues/4094).
---
This is due to it often pulling out all members for the room:
https://github.com/matrix-org/synapse/blob/6cb2e2448ab216ed3c00e2347a8ce5e9a383a552/synapse/visibility.py#L318-L323
But it turns out the majority of `/event/` requests are for events that are in the state, which joined servers should be allowed to see regardless of whether they were joined at the time the state was set. We should a) fix this and b) hopefully we can short circuit a bunch of the work if we first check if the event is in the current state of the room
Contributor guide
Assessment
This issue has not been assessed yet.