1 files changed, 7 insertions, 0 deletions
diff --git a/synapse/notifier.py b/synapse/notifier.py
index c87eb748c0..c3ecf86ec4 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -764,6 +764,13 @@ class Notifier:
async def wait_for_stream_token(self, stream_token: StreamToken) -> bool:
"""Wait for this worker to catch up with the given stream token."""
+ current_token = self.event_sources.get_current_token()
+ if stream_token.is_before_or_eq(current_token):
+ return True
+
+ # Work around a bug where older Synapse versions gave out tokens "from
+ # the future", i.e. that are ahead of the tokens persisted in the DB.
+ stream_token = await self.event_sources.bound_future_token(stream_token)
start = self.clock.time_msec()
while True:
|