Merge pull request #656 from matrix-org/erikj/get_event
Dedupe requested event list in _get_eventspull/661/head
commit
7f79a6405b
|
@ -168,5 +168,7 @@ class FrozenEvent(EventBase):
|
||||||
|
|
||||||
def __repr__(self):
|
def __repr__(self):
|
||||||
return "<FrozenEvent event_id='%s', type='%s', state_key='%s'>" % (
|
return "<FrozenEvent event_id='%s', type='%s', state_key='%s'>" % (
|
||||||
self.event_id, self.type, self.get("state_key", None),
|
self.get("event_id", None),
|
||||||
|
self.get("type", None),
|
||||||
|
self.get("state_key", None),
|
||||||
)
|
)
|
||||||
|
|
|
@ -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,23 +538,18 @@ 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([
|
missing_events = yield self._enqueue_events(
|
||||||
event_map[e_id] for e_id in event_ids
|
missing_events_ids,
|
||||||
if e_id in event_map and event_map[e_id]
|
check_redacted=check_redacted,
|
||||||
])
|
get_prev_content=get_prev_content,
|
||||||
|
allow_rejected=allow_rejected,
|
||||||
|
)
|
||||||
|
|
||||||
missing_events = yield self._enqueue_events(
|
event_map.update(missing_events)
|
||||||
missing_events_ids,
|
|
||||||
check_redacted=check_redacted,
|
|
||||||
get_prev_content=get_prev_content,
|
|
||||||
allow_rejected=allow_rejected,
|
|
||||||
)
|
|
||||||
|
|
||||||
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 New Issue