Skip to content

Add a custom __repr__ to RdataCommand for easier debugging #18778

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 3 commits into
base: develop
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/18778.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
This is a temporary newsfile.
7 changes: 3 additions & 4 deletions synapse/handlers/device.py
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,6 @@
#
#
import logging
import random
from threading import Lock
from typing import (
TYPE_CHECKING,
Expand Down Expand Up @@ -875,7 +874,7 @@ async def handle_room_un_partial_stated(self, room_id: str) -> None:
"""

await self._handle_room_un_partial_stated_client(
instance_name=random.choice(self._device_list_writers),
instance_name=self._device_list_writers[-1], # TEMP
room_id=room_id,
)

Expand All @@ -892,7 +891,7 @@ async def notify_device_update(
device_ids: The device IDs that have changed.
"""
await self._notify_device_update_client(
instance_name=random.choice(self._device_list_writers),
instance_name=self._device_list_writers[-1], # TEMP
user_id=user_id,
device_ids=list(device_ids),
)
Expand All @@ -909,7 +908,7 @@ async def notify_user_signature_update(
user_ids: The Matrix IDs of the users that have changed.
"""
await self._notify_user_signature_update_client(
instance_name=random.choice(self._device_list_writers),
instance_name=self._device_list_writers[-1], # TEMP
from_user_id=from_user_id,
user_ids=user_ids,
)
Expand Down
3 changes: 3 additions & 0 deletions synapse/replication/tcp/commands.py
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,9 @@ def __init__(
self.token = token
self.row = row

def __repr__(self) -> str:
return f"RdataCommand(stream={self.stream_name!r}, instance={self.instance_name!r}, position={self.token!r}, row=...)"

@classmethod
def from_line(cls: Type["RdataCommand"], line: str) -> "RdataCommand":
stream_name, instance_name, token, row_json = line.split(" ", 3)
Expand Down
Loading