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/rest/client/relations.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/rest/client/relations.py')
-rw-r--r-- | synapse/rest/client/relations.py | 11 |
1 files changed, 6 insertions, 5 deletions
diff --git a/synapse/rest/client/relations.py b/synapse/rest/client/relations.py index 3823498012..37d949a71e 100644 --- a/synapse/rest/client/relations.py +++ b/synapse/rest/client/relations.py @@ -113,13 +113,14 @@ class RelationPaginationServlet(RestServlet): now = self.clock.time_msec() # Do not bundle aggregations when retrieving the original event because # we want the content before relations are applied to it. - original_event = await self._event_serializer.serialize_event( - event, now, bundle_aggregations=False + original_event = self._event_serializer.serialize_event( + event, now, bundle_aggregations=None ) # The relations returned for the requested event do include their # bundled aggregations. - serialized_events = await self._event_serializer.serialize_events( - events, now, bundle_aggregations=True + aggregations = await self.store.get_bundled_aggregations(events) + serialized_events = self._event_serializer.serialize_events( + events, now, bundle_aggregations=aggregations ) return_value = pagination_chunk.to_dict() @@ -308,7 +309,7 @@ class RelationAggregationGroupPaginationServlet(RestServlet): ) now = self.clock.time_msec() - serialized_events = await self._event_serializer.serialize_events(events, now) + serialized_events = self._event_serializer.serialize_events(events, now) return_value = result.to_dict() return_value["chunk"] = serialized_events |