mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-14 16:23:52 +01:00
Speed up persisting redacted events (#10756)
This commit is contained in:
parent
1ca70fd312
commit
2ca0d64854
2 changed files with 12 additions and 11 deletions
1
changelog.d/10756.misc
Normal file
1
changelog.d/10756.misc
Normal file
|
@ -0,0 +1 @@
|
||||||
|
Minor speed ups when joining large rooms over federation.
|
|
@ -1385,18 +1385,18 @@ class PersistEventsStore:
|
||||||
# If we're persisting an unredacted event we go and ensure
|
# If we're persisting an unredacted event we go and ensure
|
||||||
# that we mark any redactions that reference this event as
|
# that we mark any redactions that reference this event as
|
||||||
# requiring censoring.
|
# requiring censoring.
|
||||||
sql = "UPDATE redactions SET have_censored = ? WHERE redacts = ?"
|
unredacted_events = [
|
||||||
txn.execute_batch(
|
event.event_id
|
||||||
sql,
|
|
||||||
(
|
|
||||||
(
|
|
||||||
False,
|
|
||||||
event.event_id,
|
|
||||||
)
|
|
||||||
for event, _ in events_and_contexts
|
for event, _ in events_and_contexts
|
||||||
if not event.internal_metadata.is_redacted()
|
if not event.internal_metadata.is_redacted()
|
||||||
),
|
]
|
||||||
|
sql = "UPDATE redactions SET have_censored = ? WHERE "
|
||||||
|
clause, args = make_in_list_sql_clause(
|
||||||
|
self.database_engine,
|
||||||
|
"redacts",
|
||||||
|
unredacted_events,
|
||||||
)
|
)
|
||||||
|
txn.execute(sql + clause, [False] + args)
|
||||||
|
|
||||||
state_events_and_contexts = [
|
state_events_and_contexts = [
|
||||||
ec for ec in events_and_contexts if ec[0].is_state()
|
ec for ec in events_and_contexts if ec[0].is_state()
|
||||||
|
|
Loading…
Reference in a new issue