Skip to content

Commit

Permalink
Also handle invalid event errors
Browse files Browse the repository at this point in the history
  • Loading branch information
erikjohnston committed Sep 1, 2024
1 parent d52c17c commit b4d0356
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions synapse/storage/databases/main/events_bg_updates.py
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,10 @@
SlidingSyncMembershipSnapshotSharedInsertValues,
SlidingSyncStateInsertValues,
)
from synapse.storage.databases.main.events_worker import DatabaseCorruptionError
from synapse.storage.databases.main.events_worker import (
DatabaseCorruptionError,
InvalidEventError,
)
from synapse.storage.databases.main.state_deltas import StateDeltasStore
from synapse.storage.databases.main.stream import StreamWorkerStore
from synapse.storage.types import Cursor
Expand Down Expand Up @@ -2090,7 +2093,7 @@ def _find_previous_membership_txn(
fetched_events = await self.get_events(
current_state_ids_map.values()
)
except DatabaseCorruptionError as e:
except (DatabaseCorruptionError, InvalidEventError) as e:
logger.warning(
"Failed to fetch state for room '%s' due to corrupted events. Ignoring. Error: %s",
room_id,
Expand Down Expand Up @@ -2197,7 +2200,7 @@ def _find_previous_membership_txn(

try:
fetched_events = await self.get_events(state_ids_map.values())
except DatabaseCorruptionError as e:
except (DatabaseCorruptionError, InvalidEventError) as e:
logger.warning(
"Failed to fetch state for room '%s' due to corrupted events. Ignoring. Error: %s",
room_id,
Expand Down

0 comments on commit b4d0356

Please sign in to comment.