mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Don't needlessly batch in add_event_to_cache
(#10784)
We've already batched up the events previously, and assume in other places in the events.py file that we have. Removing this makes it easier to adjust the batch sizes in one place.
This commit is contained in:
parent
273b6861f2
commit
7f0565e029
1
changelog.d/10784.misc
Normal file
1
changelog.d/10784.misc
Normal file
@ -0,0 +1 @@
|
||||
Minor speed ups when joining large rooms over federation.
|
@ -1547,11 +1547,10 @@ class PersistEventsStore:
|
||||
to_prefill = []
|
||||
|
||||
rows = []
|
||||
N = 200
|
||||
for i in range(0, len(events_and_contexts), N):
|
||||
ev_map = {e[0].event_id: e[0] for e in events_and_contexts[i : i + N]}
|
||||
|
||||
ev_map = {e.event_id: e for e, _ in events_and_contexts}
|
||||
if not ev_map:
|
||||
break
|
||||
return
|
||||
|
||||
sql = (
|
||||
"SELECT "
|
||||
@ -1573,9 +1572,7 @@ class PersistEventsStore:
|
||||
for row in rows:
|
||||
event = ev_map[row["event_id"]]
|
||||
if not row["rejects"] and not row["redacts"]:
|
||||
to_prefill.append(
|
||||
_EventCacheEntry(event=event, redacted_event=None)
|
||||
)
|
||||
to_prefill.append(_EventCacheEntry(event=event, redacted_event=None))
|
||||
|
||||
def prefill():
|
||||
for cache_entry in to_prefill:
|
||||
|
Loading…
Reference in New Issue
Block a user