Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Include rejected status when we log events. (#11008)
Browse files Browse the repository at this point in the history
If we find ourselves dealing with rejected events, we proably want to know
about it. Let's include it in the stringification of the event so that it gets
logged.
  • Loading branch information
richvdh authored Oct 19, 2021
1 parent 3ab55d4 commit d85bc9a
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 6 deletions.
1 change: 1 addition & 0 deletions changelog.d/11008.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Include rejected status when we log events.
16 changes: 10 additions & 6 deletions synapse/events/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -348,12 +348,16 @@ def __str__(self):
return self.__repr__()

def __repr__(self):
return "<%s event_id=%r, type=%r, state_key=%r, outlier=%s>" % (
self.__class__.__name__,
self.event_id,
self.get("type", None),
self.get("state_key", None),
self.internal_metadata.is_outlier(),
rejection = f"REJECTED={self.rejected_reason}, " if self.rejected_reason else ""

return (
f"<{self.__class__.__name__} "
f"{rejection}"
f"event_id={self.event_id}, "
f"type={self.get('type')}, "
f"state_key={self.get('state_key')}, "
f"outlier={self.internal_metadata.is_outlier()}"
">"
)


Expand Down

0 comments on commit d85bc9a

Please sign in to comment.