diff options
author | Erik Johnston <erik@matrix.org> | 2024-07-23 17:44:44 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2024-07-23 17:44:44 +0100 |
commit | 60790d651289fa040e2692c0a0c193246207ad92 (patch) | |
tree | b448ed840a8a3ee1e847686bc65fe5102c6bb7ac | |
parent | Fix tests (diff) | |
download | synapse-60790d651289fa040e2692c0a0c193246207ad92.tar.xz |
Change token names again
-rw-r--r-- | synapse/handlers/sliding_sync.py | 14 | ||||
-rw-r--r-- | synapse/types/__init__.py | 12 |
2 files changed, 14 insertions, 12 deletions
diff --git a/synapse/handlers/sliding_sync.py b/synapse/handlers/sliding_sync.py index 1173f1a144..36665db8e1 100644 --- a/synapse/handlers/sliding_sync.py +++ b/synapse/handlers/sliding_sync.py @@ -394,7 +394,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): + if not await self.notifier.wait_for_stream_token(from_token.stream_token): logger.warning( "Timed out waiting for worker to catch up. Returning empty response" ) @@ -432,7 +432,7 @@ class SlidingSyncHandler: sync_config.user.to_string(), timeout_ms, current_sync_callback, - from_token=from_token.stream, + from_token=from_token.stream_token, ) return result @@ -474,7 +474,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 if from_token else None, + from_token=from_token.stream_token if from_token else None, ) ) @@ -1435,7 +1435,7 @@ class SlidingSyncHandler: # - TODO: For an incremental sync where we haven't sent it down this # connection before to_bound = ( - from_token.stream.room_key + from_token.stream_token.room_key if from_token is not None and not room_membership_for_user_at_to_token.newly_joined else None @@ -1502,7 +1502,9 @@ 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.room_key): + if persisted_position.persisted_after( + from_token.stream_token.room_key + ): num_live += 1 else: # Since we're iterating over the timeline events in @@ -1926,7 +1928,7 @@ class SlidingSyncHandler: # TODO: This should take into account the `from_token` and `to_token` device_list_updates = await self.device_handler.get_user_ids_changed( user_id=user_id, - from_token=from_token.stream, + from_token=from_token.stream_token, ) device_one_time_keys_count: Mapping[str, int] = {} diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py index 2294bc22e0..a99f5d1a92 100644 --- a/synapse/types/__init__.py +++ b/synapse/types/__init__.py @@ -1176,8 +1176,8 @@ class SlidingSyncStreamToken: per-connection state stored by Synapse. """ - stream: StreamToken - connection: int + stream_token: StreamToken + connection_position: int @staticmethod @cancellable @@ -1189,8 +1189,8 @@ class SlidingSyncStreamToken: stream_token = await StreamToken.from_string(store, stream_token_str) return SlidingSyncStreamToken( - stream=stream_token, - connection=connection_token, + stream_token=stream_token, + connection_position=connection_token, ) except CancelledError: raise @@ -1199,8 +1199,8 @@ class SlidingSyncStreamToken: async def to_string(self, store: "DataStore") -> str: """Serializes the token to a string""" - stream_token_str = await self.stream.to_string(store) - return f"{self.connection}/{stream_token_str}" + stream_token_str = await self.stream_token.to_string(store) + return f"{self.connection_position}/{stream_token_str}" @attr.s(slots=True, frozen=True, auto_attribs=True) |