From 1b0eaed21f38a5e84089df4ba2fb881fc1242a2e Mon Sep 17 00:00:00 2001 From: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com> Date: Tue, 16 Mar 2021 10:27:51 +0000 Subject: Prevent bundling aggregations for state events (#9619) There's no need to do aggregation bundling for state events. Doing so can cause performance issues. --- changelog.d/9619.misc | 1 + synapse/rest/admin/rooms.py | 5 ++++- synapse/rest/client/v1/room.py | 5 ++++- 3 files changed, 9 insertions(+), 2 deletions(-) create mode 100644 changelog.d/9619.misc diff --git a/changelog.d/9619.misc b/changelog.d/9619.misc new file mode 100644 index 0000000000..50267bfbc4 --- /dev/null +++ b/changelog.d/9619.misc @@ -0,0 +1 @@ +Prevent attempting to bundle aggregations for state events in /context APIs. \ No newline at end of file diff --git a/synapse/rest/admin/rooms.py b/synapse/rest/admin/rooms.py index f2c42a0f30..263d8ec076 100644 --- a/synapse/rest/admin/rooms.py +++ b/synapse/rest/admin/rooms.py @@ -685,7 +685,10 @@ class RoomEventContextServlet(RestServlet): results["events_after"], time_now ) results["state"] = await self._event_serializer.serialize_events( - results["state"], time_now + results["state"], + time_now, + # No need to bundle aggregations for state events + bundle_aggregations=False, ) return 200, results diff --git a/synapse/rest/client/v1/room.py b/synapse/rest/client/v1/room.py index 9a1df30c29..5884daea6d 100644 --- a/synapse/rest/client/v1/room.py +++ b/synapse/rest/client/v1/room.py @@ -671,7 +671,10 @@ class RoomEventContextServlet(RestServlet): results["events_after"], time_now ) results["state"] = await self._event_serializer.serialize_events( - results["state"], time_now + results["state"], + time_now, + # No need to bundle aggregations for state events + bundle_aggregations=False, ) return 200, results -- cgit 1.4.1