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/search.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/search.py')
-rw-r--r-- | synapse/handlers/search.py | 10 |
1 files changed, 4 insertions, 6 deletions
diff --git a/synapse/handlers/search.py b/synapse/handlers/search.py index ab7eaab2fb..0b153a6822 100644 --- a/synapse/handlers/search.py +++ b/synapse/handlers/search.py @@ -420,10 +420,10 @@ class SearchHandler: time_now = self.clock.time_msec() for context in contexts.values(): - context["events_before"] = await self._event_serializer.serialize_events( + context["events_before"] = self._event_serializer.serialize_events( context["events_before"], time_now ) - context["events_after"] = await self._event_serializer.serialize_events( + context["events_after"] = self._event_serializer.serialize_events( context["events_after"], time_now ) @@ -441,9 +441,7 @@ class SearchHandler: results.append( { "rank": rank_map[e.event_id], - "result": ( - await self._event_serializer.serialize_event(e, time_now) - ), + "result": self._event_serializer.serialize_event(e, time_now), "context": contexts.get(e.event_id, {}), } ) @@ -457,7 +455,7 @@ class SearchHandler: if state_results: s = {} for room_id, state_events in state_results.items(): - s[room_id] = await self._event_serializer.serialize_events( + s[room_id] = self._event_serializer.serialize_events( state_events, time_now ) |