diff --git a/synapse/notifier.py b/synapse/notifier.py
index c3ecf86ec4..7a2b54036c 100644
--- a/synapse/notifier.py
+++ b/synapse/notifier.py
@@ -773,6 +773,7 @@ class Notifier:
stream_token = await self.event_sources.bound_future_token(stream_token)
start = self.clock.time_msec()
+ logged = False
while True:
current_token = self.event_sources.get_current_token()
if stream_token.is_before_or_eq(current_token):
@@ -783,11 +784,13 @@ class Notifier:
if now - start > 10_000:
return False
- logger.info(
- "Waiting for current token to reach %s; currently at %s",
- stream_token,
- current_token,
- )
+ if not logged:
+ logger.info(
+ "Waiting for current token to reach %s; currently at %s",
+ stream_token,
+ current_token,
+ )
+ logged = True
# TODO: be better
await self.clock.sleep(0.5)
diff --git a/synapse/types/__init__.py b/synapse/types/__init__.py
index 046cdc29cd..c0d30ac2a3 100644
--- a/synapse/types/__init__.py
+++ b/synapse/types/__init__.py
@@ -777,6 +777,13 @@ class RoomStreamToken(AbstractMultiWriterStreamToken):
return super().bound_stream_token(max_stream)
+ def __str__(self) -> str:
+ instances = ", ".join(f"{k}: {v}" for k, v in sorted(self.instance_map.items()))
+ return (
+ f"RoomStreamToken(stream: {self.stream}, topological: {self.topological}, "
+ f"instances: {{{instances}}})"
+ )
+
@attr.s(frozen=True, slots=True, order=False)
class MultiWriterStreamToken(AbstractMultiWriterStreamToken):
@@ -873,6 +880,13 @@ class MultiWriterStreamToken(AbstractMultiWriterStreamToken):
return True
+ def __str__(self) -> str:
+ instances = ", ".join(f"{k}: {v}" for k, v in sorted(self.instance_map.items()))
+ return (
+ f"MultiWriterStreamToken(stream: {self.stream}, "
+ f"instances: {{{instances}}})"
+ )
+
class StreamKeyType(Enum):
"""Known stream types.
@@ -1131,6 +1145,15 @@ class StreamToken:
return True
+ def __str__(self) -> str:
+ return (
+ f"StreamToken(room: {self.room_key}, presence: {self.presence_key}, "
+ f"typing: {self.typing_key}, receipt: {self.receipt_key}, "
+ f"account_data: {self.account_data_key}, push_rules: {self.push_rules_key}, "
+ f"to_device: {self.to_device_key}, device_list: {self.device_list_key}, "
+ f"groups: {self.groups_key}, un_partial_stated_rooms: {self.un_partial_stated_rooms_key})"
+ )
+
StreamToken.START = StreamToken(
RoomStreamToken(stream=0), 0, 0, MultiWriterStreamToken(stream=0), 0, 0, 0, 0, 0, 0
|