-
- Downloads
Refactor `EventContext` (#12689)
Refactor how the `EventContext` class works, with the intention of reducing the amount of state we fetch from the DB during event processing. The idea here is to get rid of the cached `current_state_ids` and `prev_state_ids` that live in the `EventContext`, and instead defer straight to the database (and its caching). One change that may have a noticeable effect is that we now no longer prefill the `get_current_state_ids` cache on a state change. However, that query is relatively light, since its just a case of reading a table from the DB (unlike fetching state at an event which is more heavyweight). For deployments with workers this cache isn't even used. Part of #12684
Showing
- changelog.d/12689.misc 1 addition, 0 deletionschangelog.d/12689.misc
- synapse/events/snapshot.py 32 additions, 145 deletionssynapse/events/snapshot.py
- synapse/handlers/federation.py 3 additions, 3 deletionssynapse/handlers/federation.py
- synapse/handlers/federation_event.py 3 additions, 3 deletionssynapse/handlers/federation_event.py
- synapse/handlers/message.py 5 additions, 1 deletionsynapse/handlers/message.py
- synapse/push/action_generator.py 4 additions, 0 deletionssynapse/push/action_generator.py
- synapse/state/__init__.py 5 additions, 4 deletionssynapse/state/__init__.py
- synapse/storage/databases/main/events.py 0 additions, 6 deletionssynapse/storage/databases/main/events.py
- synapse/storage/persist_events.py 7 additions, 35 deletionssynapse/storage/persist_events.py
- tests/handlers/test_federation_event.py 3 additions, 1 deletiontests/handlers/test_federation_event.py
- tests/storage/test_event_chain.py 1 addition, 1 deletiontests/storage/test_event_chain.py
- tests/test_state.py 3 additions, 0 deletionstests/test_state.py
- tests/test_visibility.py 3 additions, 1 deletiontests/test_visibility.py
Loading
Please register or sign in to comment