diff --git a/changelog.d/17771.misc b/changelog.d/17771.misc new file mode 100644 index 00000000000..be28223151d --- /dev/null +++ b/changelog.d/17771.misc @@ -0,0 +1 @@ +Reduce overhead of sliding sync E2EE loops. diff --git a/synapse/api/auth/msc3861_delegated.py b/synapse/api/auth/msc3861_delegated.py index 6bd845c7e30..53907c01d43 100644 --- a/synapse/api/auth/msc3861_delegated.py +++ b/synapse/api/auth/msc3861_delegated.py @@ -338,7 +338,7 @@ async def get_user_by_access_token( logger.exception("Failed to introspect token") raise SynapseError(503, "Unable to introspect the access token") - logger.info(f"Introspection result: {introspection_result!r}") + logger.debug("Introspection result: %r", introspection_result) # TODO: introspection verification should be more extensive, especially: # - verify the audience diff --git a/synapse/handlers/device.py b/synapse/handlers/device.py index 4f2a9f3a5bb..d88660e273b 100644 --- a/synapse/handlers/device.py +++ b/synapse/handlers/device.py @@ -48,6 +48,7 @@ wrap_as_background_process, ) from synapse.storage.databases.main.client_ips import DeviceLastConnectionInfo +from synapse.storage.databases.main.roommember import EventIdMembership from synapse.storage.databases.main.state_deltas import StateDelta from synapse.types import ( DeviceListUpdates, @@ -222,7 +223,6 @@ async def get_device_changes_in_shared_rooms( return changed @trace - @measure_func("device.get_user_ids_changed") @cancellable async def get_user_ids_changed( self, user_id: str, from_token: StreamToken @@ -290,9 +290,11 @@ async def get_user_ids_changed( memberships_to_fetch.add(delta.prev_event_id) # Fetch all the memberships for the membership events - event_id_to_memberships = await self.store.get_membership_from_event_ids( - memberships_to_fetch - ) + event_id_to_memberships: Mapping[str, Optional[EventIdMembership]] = {} + if memberships_to_fetch: + event_id_to_memberships = await self.store.get_membership_from_event_ids( + memberships_to_fetch + ) joined_invited_knocked = ( Membership.JOIN, @@ -349,7 +351,6 @@ async def get_user_ids_changed( return device_list_updates - @measure_func("_generate_sync_entry_for_device_list") async def generate_sync_entry_for_device_list( self, user_id: str,