Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Do not calculate presence or ephemeral events when they are filtered out #14970

Merged
merged 7 commits into from
Feb 2, 2023
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14970.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Improve performance of `/sync` in a few situations.
10 changes: 7 additions & 3 deletions synapse/handlers/sync.py
Original file line number Diff line number Diff line change
Expand Up @@ -1459,10 +1459,14 @@ async def generate_sync_result(
sync_result_builder, account_data_by_room
)

block_all_presence_data = (
since_token is None and sync_config.filter_collection.blocks_all_presence()
# Presence data is included if the server has it enabled and:
# - There is a sync token, or
# - Is not filtered out.
clokep marked this conversation as resolved.
Show resolved Hide resolved
include_presence_data = self.hs_config.server.use_presence and (
since_token is not None
or not sync_config.filter_collection.blocks_all_presence()
)
if self.hs_config.server.use_presence and not block_all_presence_data:
if include_presence_data:
logger.debug("Fetching presence data")
await self._generate_sync_entry_for_presence(
sync_result_builder,
Expand Down