diff options
author | Tulir Asokan <tulir@maunium.net> | 2021-11-29 15:13:23 +0200 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-11-29 13:13:23 +0000 |
commit | 7b4e228e415a6ed85bbd6a2fc37f305e1cb81c82 (patch) | |
tree | 55e00dd0a1b515831316c9769322af22d23db233 | |
parent | disallow-untyped-defs for the module_api (#11029) (diff) | |
download | synapse-7b4e228e415a6ed85bbd6a2fc37f305e1cb81c82.tar.xz |
Fix using MSC2716 batch sending with event persistence workers (#11220)
Signed-off-by: Tulir Asokan <tulir@beeper.com>
-rw-r--r-- | changelog.d/11220.bugfix | 1 | ||||
-rw-r--r-- | synapse/app/generic_worker.py | 2 | ||||
-rw-r--r-- | synapse/events/snapshot.py | 5 |
3 files changed, 8 insertions, 0 deletions
diff --git a/changelog.d/11220.bugfix b/changelog.d/11220.bugfix new file mode 100644 index 0000000000..8baae28d5b --- /dev/null +++ b/changelog.d/11220.bugfix @@ -0,0 +1 @@ +Fix using MSC2716 batch sending in combination with event persistence workers. Contributed by @tulir at Beeper. diff --git a/synapse/app/generic_worker.py b/synapse/app/generic_worker.py index 502cc8e8d1..b4bed5bf40 100644 --- a/synapse/app/generic_worker.py +++ b/synapse/app/generic_worker.py @@ -113,6 +113,7 @@ from synapse.storage.databases.main.monthly_active_users import ( ) from synapse.storage.databases.main.presence import PresenceStore from synapse.storage.databases.main.room import RoomWorkerStore +from synapse.storage.databases.main.room_batch import RoomBatchStore from synapse.storage.databases.main.search import SearchStore from synapse.storage.databases.main.session import SessionStore from synapse.storage.databases.main.stats import StatsStore @@ -240,6 +241,7 @@ class GenericWorkerSlavedStore( SlavedEventStore, SlavedKeyStore, RoomWorkerStore, + RoomBatchStore, DirectoryStore, SlavedApplicationServiceStore, SlavedRegistrationStore, diff --git a/synapse/events/snapshot.py b/synapse/events/snapshot.py index d7527008c4..f251402ed8 100644 --- a/synapse/events/snapshot.py +++ b/synapse/events/snapshot.py @@ -322,6 +322,11 @@ class _AsyncEventContextImpl(EventContext): attributes by loading from the database. """ if self.state_group is None: + # No state group means the event is an outlier. Usually the state_ids dicts are also + # pre-set to empty dicts, but they get reset when the context is serialized, so set + # them to empty dicts again here. + self._current_state_ids = {} + self._prev_state_ids = {} return current_state_ids = await self._storage.state.get_state_ids_for_group( |