MatrixSynapse/synapse/handlers
Eric Eastwood df8b91ed2b
Limit and filter the number of backfill points to get from the database (#13879)
There is no need to grab thousands of backfill points when we only need 5 to make the `/backfill` request with. We need to grab a few extra in case the first few aren't visible in the history.

Previously, we grabbed thousands of backfill points from the database, then sorted and filtered them in the app. Fetching the 4.6k backfill points for `#matrix:matrix.org` from the database takes ~50ms - ~570ms so it's not like this saves a lot of time 🤷. But it might save us more time now that `get_backfill_points_in_room`/`get_insertion_event_backward_extremities_in_room` are more complicated after https://github.com/matrix-org/synapse/pull/13635 

This PR moves the filtering and limiting to the SQL query so we just have less data to work with in the first place.

Part of https://github.com/matrix-org/synapse/issues/13356
2022-09-28 15:26:16 -05:00
..
ui_auth Drop support for delegating email validation, round 2 (#13596) 2022-08-23 11:40:00 +00:00
__init__.py Remove redundant "coding: utf-8" lines (#9786) 2021-04-14 15:34:27 +01:00
account.py Optionally include account validity in MSC3720 account status responses (#12266) 2022-03-24 11:19:41 +01:00
account_data.py Add `StreamKeyType` class and replace string literals with constants (#12567) 2022-05-16 15:35:31 +00:00
account_validity.py Implement cancellation support/protection for module callbacks (#12568) 2022-05-09 12:31:14 +01:00
admin.py Add timestamp to user's consent (#13741) 2022-09-08 15:41:48 +00:00
appservice.py Federation Sender & Appservice Pusher Stream Optimisations (#13251) 2022-07-15 09:36:56 +01:00
auth.py Remove the `complete_sso_login` method from the Module API which was deprecated in Synapse 1.13.0. (#13843) 2022-09-20 15:18:07 +02:00
cas.py Remove `HomeServer.get_datastore()` (#12031) 2022-02-23 11:04:02 +00:00
deactivate_account.py Add third_party module callbacks to check if a user can delete a room and deactivate a user (#12028) 2022-03-09 18:23:57 +00:00
device.py Handle remote device list updates during partial join (#13913) 2022-09-28 13:42:43 +00:00
devicemessage.py Additional constants for EDU types. (#12884) 2022-05-27 07:14:36 -04:00
directory.py Update `get_users_in_room` mis-use to get hosts with dedicated `get_current_hosts_in_room` (#13605) 2022-08-24 14:15:37 -05:00
e2e_keys.py Remove error spam when users query the keys of departed remote users (#13826) 2022-09-16 16:16:05 +01:00
e2e_room_keys.py Add missing types to opentracing. (#13345) 2022-07-21 12:01:52 +00:00
event_auth.py Faster Remote Room Joins: tell remote homeservers that we are unable to authorise them if they query a room which has partial state on our server. (#13823) 2022-09-23 11:47:16 +01:00
events.py Directly lookup local membership instead of getting all members in a room first (`get_users_in_room` mis-use) (#13608) 2022-08-24 14:13:12 -05:00
federation.py Limit and filter the number of backfill points to get from the database (#13879) 2022-09-28 15:26:16 -05:00
federation_event.py fix: Push notifications for invite over federation (#13719) 2022-09-28 12:31:53 +00:00
identity.py Drop support for calling `/_matrix/client/v3/rooms/{roomId}/invite` without an `id_access_token` (#13241) 2022-08-31 12:10:25 +00:00
initial_sync.py `synapse.api.auth.Auth` cleanup: make permission-related methods use `Requester` instead of the `UserID` (#13024) 2022-08-22 14:17:59 +01:00
message.py Persist CreateRoom events to DB in a batch (#13800) 2022-09-28 10:11:48 +00:00
oidc.py Move the "email unsubscribe" resource, refactor the macaroon generator & simplify the access token verification logic. (#12986) 2022-06-14 09:12:08 -04:00
pagination.py Add Admin API to Fetch Messages Within a Particular Window (#13672) 2022-09-07 10:54:44 +01:00
password_policy.py Use direct references for some configuration variables (part 3) (#10885) 2021-09-23 07:13:34 -04:00
presence.py Update `get_users_in_room` mis-use to get hosts with dedicated `get_current_hosts_in_room` (#13605) 2022-08-24 14:15:37 -05:00
profile.py Use a single query in `ProfileHandler.get_profile` (#13209) 2022-07-07 11:02:09 +00:00
push_rules.py Port the push rule classes to Rust. (#13768) 2022-09-20 12:10:31 +01:00
read_marker.py Refactor and convert `Linearizer` to async (#12357) 2022-04-05 15:43:52 +01:00
receipts.py Accept & store thread IDs for receipts (implement MSC3771). (#13782) 2022-09-23 14:33:28 +00:00
register.py Support enabling/disabling pushers (from MSC3881) (#13799) 2022-09-21 14:39:01 +00:00
relations.py `synapse.api.auth.Auth` cleanup: make permission-related methods use `Requester` instead of the `UserID` (#13024) 2022-08-22 14:17:59 +01:00
room.py Persist CreateRoom events to DB in a batch (#13800) 2022-09-28 10:11:48 +00:00
room_batch.py Persist CreateRoom events to DB in a batch (#13800) 2022-09-28 10:11:48 +00:00
room_list.py Use stable prefixes for MSC3827: filtering of `/publicRooms` by room type (#13370) 2022-07-27 19:46:57 +01:00
room_member.py Persist CreateRoom events to DB in a batch (#13800) 2022-09-28 10:11:48 +00:00
room_member_worker.py Implement knock feature (#6739) 2021-06-09 19:39:51 +01:00
room_summary.py Faster Remote Room Joins: tell remote homeservers that we are unable to authorise them if they query a room which has partial state on our server. (#13823) 2022-09-23 11:47:16 +01:00
saml.py Remove `HomeServer.get_datastore()` (#12031) 2022-02-23 11:04:02 +00:00
search.py Reduce the amount of state we pull from the DB (#12811) 2022-06-06 09:24:12 +01:00
send_email.py Support Implicit TLS for sending emails (#13317) 2022-07-25 16:27:19 +01:00
set_password.py Remove `HomeServer.get_datastore()` (#12031) 2022-02-23 11:04:02 +00:00
sso.py Carry IdP Session IDs through user-mapping sessions. (#13839) 2022-09-27 14:38:14 +01:00
state_deltas.py Remove `HomeServer.get_datastore()` (#12031) 2022-02-23 11:04:02 +00:00
stats.py Implement MSC3827: Filtering of `/publicRooms` by room type (#13031) 2022-06-29 17:12:45 +00:00
sync.py Faster room joins: Fix spurious error when joining a room (#13872) 2022-09-27 11:17:23 +01:00
typing.py typing: check origin server of typing event against room's servers (#13830) 2022-09-26 17:33:32 +02:00
user_directory.py Wait for lazy join to complete when getting current state (#12872) 2022-06-01 16:02:53 +01:00