mirror of
https://mau.dev/maunium/synapse.git
synced 2024-10-01 01:36:05 -04:00
Use get_events_as_list rather than lots of calls to get_event
It's more efficient and clearer.
This commit is contained in:
parent
f8407975e7
commit
f41027f746
@ -2210,26 +2210,18 @@ class FederationHandler(BaseHandler):
|
|||||||
# idea of them.
|
# idea of them.
|
||||||
|
|
||||||
room_version = yield self.store.get_room_version(event.room_id)
|
room_version = yield self.store.get_room_version(event.room_id)
|
||||||
|
different_event_ids = [
|
||||||
|
d for d in different_auth if d in have_events and not have_events[d]
|
||||||
|
]
|
||||||
|
|
||||||
different_events = yield make_deferred_yieldable(
|
if different_event_ids:
|
||||||
defer.gatherResults(
|
# XXX: currently this checks for redactions but I'm not convinced that is
|
||||||
[
|
# necessary?
|
||||||
run_in_background(
|
different_events = yield self.store.get_events_as_list(different_event_ids)
|
||||||
self.store.get_event, d, allow_none=True, allow_rejected=False
|
|
||||||
)
|
|
||||||
for d in different_auth
|
|
||||||
if d in have_events and not have_events[d]
|
|
||||||
],
|
|
||||||
consumeErrors=True,
|
|
||||||
)
|
|
||||||
).addErrback(unwrapFirstError)
|
|
||||||
|
|
||||||
if different_events:
|
|
||||||
local_view = dict(auth_events)
|
local_view = dict(auth_events)
|
||||||
remote_view = dict(auth_events)
|
remote_view = dict(auth_events)
|
||||||
remote_view.update(
|
remote_view.update({(d.type, d.state_key): d for d in different_events})
|
||||||
{(d.type, d.state_key): d for d in different_events if d}
|
|
||||||
)
|
|
||||||
|
|
||||||
new_state = yield self.state_handler.resolve_events(
|
new_state = yield self.state_handler.resolve_events(
|
||||||
room_version,
|
room_version,
|
||||||
|
Loading…
Reference in New Issue
Block a user