mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 11:13:49 +01:00
Merge pull request #5324 from matrix-org/erikj/ignore_null
Ignore room state with null bytes in for room stats
This commit is contained in:
commit
d1d38081a7
2 changed files with 17 additions and 0 deletions
1
changelog.d/5324.feature
Normal file
1
changelog.d/5324.feature
Normal file
|
@ -0,0 +1 @@
|
|||
Synapse now more efficiently collates room statistics.
|
|
@ -328,6 +328,22 @@ class StatsStore(StateDeltasStore):
|
|||
room_id (str)
|
||||
fields (dict[str:Any])
|
||||
"""
|
||||
|
||||
# For whatever reason some of the fields may contain null bytes, which
|
||||
# postgres isn't a fan of, so we replace those fields with null.
|
||||
for col in (
|
||||
"join_rules",
|
||||
"history_visibility",
|
||||
"encryption",
|
||||
"name",
|
||||
"topic",
|
||||
"avatar",
|
||||
"canonical_alias"
|
||||
):
|
||||
field = fields.get(col)
|
||||
if field and "\0" in field:
|
||||
fields[col] = None
|
||||
|
||||
return self._simple_upsert(
|
||||
table="room_state",
|
||||
keyvalues={"room_id": room_id},
|
||||
|
|
Loading…
Reference in a new issue