mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-05-08 00:15:10 -04:00
Improve /sync performance of when passing filters with empty arrays. (#14786)
This has two related changes: * It enables fast-path processing for an empty filter (`[]`) which was previously only used for wildcard not-filters (`["*"]`). * It special cases a `/sync` filter with no-rooms to skip all room processing, previously we would partially skip processing, but would generally still calculate intermediate values for each room which were then unused. Future changes might consider further optimizations: * Skip calculating per-room account data when all rooms are filtered (currently this is thrown away). * Make similar improvements to other endpoints which support filters.
This commit is contained in:
parent
5e0888076f
commit
7e582a25f8
4 changed files with 21 additions and 9 deletions
|
@ -1403,11 +1403,14 @@ class SyncHandler:
|
|||
|
||||
logger.debug("Fetching room data")
|
||||
|
||||
res = await self._generate_sync_entry_for_rooms(
|
||||
(
|
||||
newly_joined_rooms,
|
||||
newly_joined_or_invited_or_knocked_users,
|
||||
newly_left_rooms,
|
||||
newly_left_users,
|
||||
) = await self._generate_sync_entry_for_rooms(
|
||||
sync_result_builder, account_data_by_room
|
||||
)
|
||||
newly_joined_rooms, newly_joined_or_invited_or_knocked_users, _, _ = res
|
||||
_, _, newly_left_rooms, newly_left_users = res
|
||||
|
||||
block_all_presence_data = (
|
||||
since_token is None and sync_config.filter_collection.blocks_all_presence()
|
||||
|
@ -1789,6 +1792,11 @@ class SyncHandler:
|
|||
- newly_left_rooms
|
||||
- newly_left_users
|
||||
"""
|
||||
|
||||
# If the request doesn't care about rooms then nothing to do!
|
||||
if sync_result_builder.sync_config.filter_collection.blocks_all_rooms():
|
||||
return set(), set(), set(), set()
|
||||
|
||||
since_token = sync_result_builder.since_token
|
||||
|
||||
# 1. Start by fetching all ephemeral events in rooms we've joined (if required).
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue