diff options
author | Erik Johnston <erik@matrix.org> | 2024-07-18 12:00:48 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2024-07-18 12:00:48 +0100 |
commit | 560087bf87f501145858b52e11b2dd4d6a555a53 (patch) | |
tree | 20b3ace24c16a5fd0c292130878286c6498c375e /synapse | |
parent | Add docstring (diff) | |
download | synapse-560087bf87f501145858b52e11b2dd4d6a555a53.tar.xz |
Remove '_token' prefix
Diffstat (limited to 'synapse')
-rw-r--r-- | synapse/handlers/sliding_sync.py | 12 | ||||
-rw-r--r-- | synapse/types/__init__.py | 16 |
2 files changed, 13 insertions, 15 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 3aa139ff1c..80ca3fa587 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -379,7 +379,7 @@ class SlidingSyncHandler: # this returns false, it means we timed out waiting, and we should # just return an empty response. before_wait_ts = self.clock.time_msec() - if not await self.notifier.wait_for_stream_token(from_token.stream_token): + if not await self.notifier.wait_for_stream_token(from_token.stream): logger.warning( "Timed out waiting for worker to catch up. Returning empty response" ) @@ -417,7 +417,7 @@ class SlidingSyncHandler: sync_config.user.to_string(), timeout_ms, current_sync_callback, - from_token=from_token.stream_token, + from_token=from_token.stream, ) return result @@ -459,7 +459,7 @@ class SlidingSyncHandler: await self.get_room_membership_for_user_at_to_token( user=sync_config.user, to_token=to_token, - from_token=from_token.stream_token if from_token else None, + from_token=from_token.stream if from_token else None, ) ) @@ -1414,7 +1414,7 @@ class SlidingSyncHandler: # - TODO: For an incremental sync where we haven't sent it down this # connection before to_bound = ( - from_token.stream_token.room_key + from_token.stream.room_key if from_token is not None and not room_membership_for_user_at_to_token.newly_joined else None @@ -1481,9 +1481,7 @@ class SlidingSyncHandler: instance_name=timeline_event.internal_metadata.instance_name, stream=timeline_event.internal_metadata.stream_ordering, ) - if persisted_position.persisted_after( - from_token.stream_token.room_key - ): + if persisted_position.persisted_after(from_token.stream.room_key): num_live += 1 else: # Since we're iterating over the timeline events in diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py index 53401ade84..a0956febc0 100644 --- a/synapse/types/__init__.py +++ b/synapse/types/__init__.py @@ -1147,14 +1147,14 @@ class SlidingSyncStreamToken: 5/s2633508_17_338_6732159_1082514_541479_274711_265584_1_379 Attributes: - stream_token: Token representing the position of all the standard + stream: Token representing the position of all the standard streams. - connection_token: Token used by sliding sync to track updates to any + connection: Token used by sliding sync to track updates to any per-connection state stored by Synapse. """ - stream_token: StreamToken - connection_token: int + stream: StreamToken + connection: int @staticmethod @cancellable @@ -1166,8 +1166,8 @@ class SlidingSyncStreamToken: stream_token = await StreamToken.from_string(store, stream_token_str) return SlidingSyncStreamToken( - stream_token=stream_token, - connection_token=connection_token, + stream=stream_token, + connection=connection_token, ) except CancelledError: raise @@ -1176,8 +1176,8 @@ class SlidingSyncStreamToken: async def to_string(self, store: "DataStore") -> str: """Serializes the token to a string""" - stream_token_str = await self.stream_token.to_string(store) - return f"{self.connection_token}/{stream_token_str}" + stream_token_str = await self.stream.to_string(store) + return f"{self.connection}/{stream_token_str}" @attr.s(slots=True, frozen=True, auto_attribs=True) |