diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-01-07 09:10:46 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-01-07 09:10:46 -0500 |
commit | 6bf81a7a61d8d5248be5def955104c44fcb78dae (patch) | |
tree | 2e1222879c207d00a2545f0a3962c31a0b801a9a /synapse/handlers/room.py | |
parent | Remove the /send_relation endpoint. (#11682) (diff) | |
download | synapse-6bf81a7a61d8d5248be5def955104c44fcb78dae.tar.xz |
Bundle aggregations outside of the serialization method. (#11612)
This makes the serialization of events synchronous (and it no longer access the database), but we must manually calculate and provide the bundled aggregations. Overall this should cause no change in behavior, but is prep work for other improvements.
Diffstat (limited to 'synapse/handlers/room.py')
-rw-r--r-- | synapse/handlers/room.py | 10 |
1 files changed, 10 insertions, 0 deletions
diff --git a/synapse/handlers/room.py b/synapse/handlers/room.py index 3d3a0f6ac3..3d47163f25 100644 --- a/synapse/handlers/room.py +++ b/synapse/handlers/room.py @@ -1181,6 +1181,16 @@ class RoomContextHandler: # `filtered` rather than the event we retrieved from the datastore. results["event"] = filtered[0] + # Fetch the aggregations. + aggregations = await self.store.get_bundled_aggregations([results["event"]]) + aggregations.update( + await self.store.get_bundled_aggregations(results["events_before"]) + ) + aggregations.update( + await self.store.get_bundled_aggregations(results["events_after"]) + ) + results["aggregations"] = aggregations + if results["events_after"]: last_event_id = results["events_after"][-1].event_id else: |