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

Commit

Permalink
Log and ignore broken events when retrieving from the database.
Browse files Browse the repository at this point in the history
  • Loading branch information
clokep committed Aug 18, 2020
1 parent 1729710 commit 5516ae2
Showing 1 changed file with 14 additions and 2 deletions.
16 changes: 14 additions & 2 deletions synapse/storage/databases/main/events_worker.py
Original file line number Diff line number Diff line change
Expand Up @@ -574,8 +574,20 @@ def _get_events_from_db(self, event_ids, allow_rejected=False):
if not allow_rejected and rejected_reason:
continue

d = db_to_json(row["json"])
internal_metadata = db_to_json(row["internal_metadata"])
# If the event or metadata cannot be parsed, log the error and act
# as if the event is unknown.
try:
d = db_to_json(row["json"])
except ValueError:
logger.error("Unable to parse json from event: %s", event_id)
continue
try:
internal_metadata = db_to_json(row["internal_metadata"])
except ValueError:
logger.error(
"Unable to parse internal_metadata from event: %s", event_id
)
continue

format_version = row["format_version"]
if format_version is None:
Expand Down

0 comments on commit 5516ae2

Please sign in to comment.