mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-07 06:32:13 -04:00
Skip processing stats for broken rooms. (#14873)
* Skip processing stats for broken rooms. * Newsfragment * Use a custom exception.
This commit is contained in:
parent
2ec9c58496
commit
82d3efa312
4 changed files with 72 additions and 36 deletions
|
@ -29,6 +29,7 @@ from synapse.storage.database import (
|
|||
LoggingDatabaseConnection,
|
||||
LoggingTransaction,
|
||||
)
|
||||
from synapse.storage.databases.main.events_worker import InvalidEventError
|
||||
from synapse.storage.databases.main.state_deltas import StateDeltasStore
|
||||
from synapse.types import JsonDict
|
||||
from synapse.util.caches.descriptors import cached
|
||||
|
@ -554,7 +555,17 @@ class StatsStore(StateDeltasStore):
|
|||
"get_initial_state_for_room", _fetch_current_state_stats
|
||||
)
|
||||
|
||||
state_event_map = await self.get_events(event_ids, get_prev_content=False) # type: ignore[attr-defined]
|
||||
try:
|
||||
state_event_map = await self.get_events(event_ids, get_prev_content=False) # type: ignore[attr-defined]
|
||||
except InvalidEventError as e:
|
||||
# If an exception occurs fetching events then the room is broken;
|
||||
# skip process it to avoid being stuck on a room.
|
||||
logger.warning(
|
||||
"Failed to fetch events for room %s, skipping stats calculation: %r.",
|
||||
room_id,
|
||||
e,
|
||||
)
|
||||
return
|
||||
|
||||
room_state: Dict[str, Union[None, bool, str]] = {
|
||||
"join_rules": None,
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue