Skip to content

feat: truncate large payloads in RoborockMessage __repr__#873

Merged
allenporter merged 1 commit into
Python-roborock:mainfrom
allenporter:truncate-large-payloads
Jul 12, 2026
Merged

feat: truncate large payloads in RoborockMessage __repr__#873
allenporter merged 1 commit into
Python-roborock:mainfrom
allenporter:truncate-large-payloads

Conversation

@allenporter

Copy link
Copy Markdown
Contributor

This PR introduces a custom __repr__ implementation for RoborockMessage that truncates payloads (bytes, bytearray, str) exceeding 1024 bytes (defined by MAX_PAYLOAD_REPR_LEN). This prevents large map binary messages from bloating and clogging the debug logs.

Comment on lines +289 to +290
def __repr__(self) -> str:
payload_repr = "None"

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

can we add a little commenting here? Just to make it a bit easier to quickly see what our current form is if we need to change?

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

eh actually jk. string at the bottom is probably sufficient

@allenporter allenporter merged commit 95460d7 into Python-roborock:main Jul 12, 2026
7 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants