From 812fcbeb253413769bf5745deb559ef3314703fb Mon Sep 17 00:00:00 2001 From: Erik Johnston Date: Wed, 29 Apr 2026 13:10:35 +0100 Subject: [PATCH] Apply suggestions from code review Co-authored-by: Eric Eastwood --- synapse/handlers/sliding_sync/__init__.py | 6 +++--- .../client/sliding_sync/test_rooms_required_state.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/synapse/handlers/sliding_sync/__init__.py b/synapse/handlers/sliding_sync/__init__.py index 16497a3bd4..60670c3736 100644 --- a/synapse/handlers/sliding_sync/__init__.py +++ b/synapse/handlers/sliding_sync/__init__.py @@ -196,9 +196,9 @@ class SlidingSyncHandler: sync_config.user.to_string(), timeout_ms, current_sync_callback, - # We *wait* from `now_token` as we have already computed the sync - # response up to `now_token` above, so we want to wait for something - # new to arrive after `now_token`. + # We *wait* from `now_token` as we have already computed the sync response + # up to `now_token` above, so as a minor optimization, we can wait for + # something new to arrive after `now_token`. # # We still generate the sync response using `from_token` in the # callback above though. diff --git a/tests/rest/client/sliding_sync/test_rooms_required_state.py b/tests/rest/client/sliding_sync/test_rooms_required_state.py index a989598738..b2bc097f96 100644 --- a/tests/rest/client/sliding_sync/test_rooms_required_state.py +++ b/tests/rest/client/sliding_sync/test_rooms_required_state.py @@ -2247,8 +2247,8 @@ class SlidingSyncRoomsRequiredStateTestCase(SlidingSyncBase): ) def test_changing_required_state_returns_immediately(self) -> None: - """Test that if we change the required state, then we return immediately - with the new required state.""" + """Test that if we change the `required_state`, then we return immediately + with the new `required_state`.""" user1_id = self.register_user("user1", "pass") user1_tok = self.login(user1_id, "pass") @@ -2281,7 +2281,7 @@ class SlidingSyncRoomsRequiredStateTestCase(SlidingSyncBase): sync_body, since=from_token, tok=user1_tok, - timeout_ms=10_000, + timeout_ms=Duration(seconds=10).as_millis(), await_result=False, ) self.reactor.advance(0.1) # Allow the request to start processing @@ -2293,7 +2293,7 @@ class SlidingSyncRoomsRequiredStateTestCase(SlidingSyncBase): self.reactor.advance(1) self.assertTrue(channel.is_finished()) - # Now update the sliding sync requests to include a required state + # Now update the Sliding Sync requests to include a `required_state` # event, and make another sync request. sync_body["lists"]["foo-list"]["required_state"] = [ [EventTypes.Create, ""], @@ -2303,7 +2303,7 @@ class SlidingSyncRoomsRequiredStateTestCase(SlidingSyncBase): sync_body, since=from_token, tok=user1_tok, timeout_ms=10_000 ) - # We should see the new required state immediately without waiting. + # We should see the new `required_state` immediately without waiting. self._assertRequiredStateIncludes( response_body["rooms"][room_id1]["required_state"], {