mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2025-01-04 03:30:51 -05:00
Fix exceptions from background database update for event labels. (#6407)
Add some exception handling here so that events whose json cannot be parsed are ignored rather than getting us stuck in a loop. Fixes #6404.
This commit is contained in:
parent
41e4566682
commit
b7367c339d
1
changelog.d/6407.bugfix
Normal file
1
changelog.d/6407.bugfix
Normal file
@ -0,0 +1 @@
|
||||
Fix a bug which could cause the background database update hander for event labels to get stuck in a loop raising exceptions.
|
@ -530,6 +530,7 @@ class EventsBackgroundUpdatesStore(BackgroundUpdateStore):
|
||||
nbrows = 0
|
||||
last_row_event_id = ""
|
||||
for (event_id, event_json_raw) in results:
|
||||
try:
|
||||
event_json = json.loads(event_json_raw)
|
||||
|
||||
self._simple_insert_many_txn(
|
||||
@ -548,6 +549,12 @@ class EventsBackgroundUpdatesStore(BackgroundUpdateStore):
|
||||
if isinstance(label, str)
|
||||
],
|
||||
)
|
||||
except Exception as e:
|
||||
logger.warning(
|
||||
"Unable to load event %s (no labels will be imported): %s",
|
||||
event_id,
|
||||
e,
|
||||
)
|
||||
|
||||
nbrows += 1
|
||||
last_row_event_id = event_id
|
||||
|
Loading…
Reference in New Issue
Block a user