Fix condition

See https://github.com/element-hq/synapse/pull/19644#discussion_r3030326143

Example test failure:
```shell
$ SYNAPSE_TEST_LOG_LEVEL=INFO poetry run trial tests.handlers.test_sync.SyncTestCase_state.test_wait_for_invalid_future_sync_token_ROOM
tests.handlers.test_sync
  SyncTestCase_state
    test_wait_for_invalid_future_sync_token_ROOM ...                     [FAIL]

===============================================================================
[FAIL]
Traceback (most recent call last):
  File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.14/lib/python3.14/site-packages/parameterized/parameterized.py", line 620, in standalone_func
    return func(*(a + p.args), **p.kwargs, **kw)
  File "/home/eric/Documents/github/element/synapse/tests/handlers/test_sync.py", line 1115, in test_wait_for_invalid_future_sync_token
    self.get_success(sync_d)
  File "/home/eric/Documents/github/element/synapse/tests/unittest.py", line 742, in get_success
    return self.successResultOf(deferred)
  File "/home/eric/.cache/pypoetry/virtualenvs/matrix-synapse-xCtC9ulO-py3.14/lib/python3.14/site-packages/twisted/trial/_synctest.py", line 723, in successResultOf
    self.fail(
twisted.trial.unittest.FailTest: Success result expected on <Deferred at 0x7f7579165b50>, found no result instead

tests.handlers.test_sync.SyncTestCase_state.test_wait_for_invalid_future_sync_token_ROOM
-------------------------------------------------------------------------------
Ran 1 tests in 0.163s

FAILED (failures=1)
```
This commit is contained in:
Eric Eastwood
2026-04-02 15:53:51 -05:00
parent 4ba64fc35a
commit ff5402f414
+1 -1
View File
@@ -686,7 +686,7 @@ class AbstractMultiWriterStreamToken(metaclass=abc.ABCMeta):
def bound_stream_token(self, max_stream: int) -> "Self":
"""Bound the stream positions to a maximum value"""
# Shortcut if we're already under the bound
if max_stream <= self.get_max_stream_pos():
if self.get_max_stream_pos() <= max_stream:
return self
min_pos = min(self.stream, max_stream)