mirror of
https://mau.dev/maunium/synapse.git
synced 2024-12-15 08:23:51 +01:00
Dedupe requested event list in _get_events
This commit is contained in:
parent
384ee6eafb
commit
67ed8065db
1 changed files with 12 additions and 14 deletions
|
@ -526,6 +526,9 @@ class EventsStore(SQLBaseStore):
|
||||||
if not event_ids:
|
if not event_ids:
|
||||||
defer.returnValue([])
|
defer.returnValue([])
|
||||||
|
|
||||||
|
event_id_list = event_ids
|
||||||
|
event_ids = set(event_ids)
|
||||||
|
|
||||||
event_map = self._get_events_from_cache(
|
event_map = self._get_events_from_cache(
|
||||||
event_ids,
|
event_ids,
|
||||||
check_redacted=check_redacted,
|
check_redacted=check_redacted,
|
||||||
|
@ -535,12 +538,7 @@ class EventsStore(SQLBaseStore):
|
||||||
|
|
||||||
missing_events_ids = [e for e in event_ids if e not in event_map]
|
missing_events_ids = [e for e in event_ids if e not in event_map]
|
||||||
|
|
||||||
if not missing_events_ids:
|
if missing_events_ids:
|
||||||
defer.returnValue([
|
|
||||||
event_map[e_id] for e_id in event_ids
|
|
||||||
if e_id in event_map and event_map[e_id]
|
|
||||||
])
|
|
||||||
|
|
||||||
missing_events = yield self._enqueue_events(
|
missing_events = yield self._enqueue_events(
|
||||||
missing_events_ids,
|
missing_events_ids,
|
||||||
check_redacted=check_redacted,
|
check_redacted=check_redacted,
|
||||||
|
@ -551,7 +549,7 @@ class EventsStore(SQLBaseStore):
|
||||||
event_map.update(missing_events)
|
event_map.update(missing_events)
|
||||||
|
|
||||||
defer.returnValue([
|
defer.returnValue([
|
||||||
event_map[e_id] for e_id in event_ids
|
event_map[e_id] for e_id in event_id_list
|
||||||
if e_id in event_map and event_map[e_id]
|
if e_id in event_map and event_map[e_id]
|
||||||
])
|
])
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue