Speed up persisting redacted events (#10756)
parent
1ca70fd312
commit
2ca0d64854
|
@ -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,
|
for event, _ in events_and_contexts
|
||||||
(
|
if not event.internal_metadata.is_redacted()
|
||||||
(
|
]
|
||||||
False,
|
sql = "UPDATE redactions SET have_censored = ? WHERE "
|
||||||
event.event_id,
|
clause, args = make_in_list_sql_clause(
|
||||||
)
|
self.database_engine,
|
||||||
for event, _ in events_and_contexts
|
"redacts",
|
||||||
if not event.internal_metadata.is_redacted()
|
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 New Issue