From 2e09e2163e6c8e699b95c63c9a2ce34d3486cb6f Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 15 Mar 2021 15:34:13 +0000 Subject: [PATCH 1/2] Only send catch up events if they're the latest in the room --- synapse/storage/databases/main/transactions.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/synapse/storage/databases/main/transactions.py b/synapse/storage/databases/main/transactions.py index 030966184140..f14a133c0b0e 100644 --- a/synapse/storage/databases/main/transactions.py +++ b/synapse/storage/databases/main/transactions.py @@ -428,7 +428,8 @@ def _get_catch_up_room_event_ids_txn( ) -> List[str]: q = """ SELECT event_id FROM destination_rooms - JOIN events USING (stream_ordering) + INNER JOIN events USING (stream_ordering) + INNER JOIN event_forward_extremities USING (event_id) WHERE destination = ? AND stream_ordering > ? ORDER BY stream_ordering From a0881634fa60e904252ba5b3bc498c4fc6272320 Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Mon, 15 Mar 2021 16:50:36 +0000 Subject: [PATCH 2/2] Newsfile --- changelog.d/9621.misc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/9621.misc diff --git a/changelog.d/9621.misc b/changelog.d/9621.misc new file mode 100644 index 000000000000..d865e8fb68d6 --- /dev/null +++ b/changelog.d/9621.misc @@ -0,0 +1 @@ +Only send catch up events if they're the latest in the room, reducing the number of events a server receives after recovering from downtime.