mirror of
https://git.anonymousland.org/anonymousland/synapse-product.git
synced 2024-12-30 15:56:10 -05:00
Rename _auth_and_persist_fetched_events
(#11116)
... to `_auth_and_persist_outliers`, since that reflects its purpose better.
This commit is contained in:
parent
d85bc9a4a7
commit
0170774b19
1
changelog.d/11116.misc
Normal file
1
changelog.d/11116.misc
Normal file
@ -0,0 +1 @@
|
|||||||
|
Clean up some of the federation event authentication code for clarity.
|
@ -1116,14 +1116,12 @@ class FederationEventHandler:
|
|||||||
|
|
||||||
await concurrently_execute(get_event, event_ids, 5)
|
await concurrently_execute(get_event, event_ids, 5)
|
||||||
logger.info("Fetched %i events of %i requested", len(events), len(event_ids))
|
logger.info("Fetched %i events of %i requested", len(events), len(event_ids))
|
||||||
await self._auth_and_persist_fetched_events(destination, room_id, events)
|
await self._auth_and_persist_outliers(room_id, events)
|
||||||
|
|
||||||
async def _auth_and_persist_fetched_events(
|
async def _auth_and_persist_outliers(
|
||||||
self, origin: str, room_id: str, events: Iterable[EventBase]
|
self, room_id: str, events: Iterable[EventBase]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Persist the events fetched by _get_events_and_persist or _get_remote_auth_chain_for_event
|
"""Persist a batch of outlier events fetched from remote servers.
|
||||||
|
|
||||||
The events to be persisted must be outliers.
|
|
||||||
|
|
||||||
We first sort the events to make sure that we process each event's auth_events
|
We first sort the events to make sure that we process each event's auth_events
|
||||||
before the event itself, and then auth and persist them.
|
before the event itself, and then auth and persist them.
|
||||||
@ -1131,7 +1129,6 @@ class FederationEventHandler:
|
|||||||
Notifies about the events where appropriate.
|
Notifies about the events where appropriate.
|
||||||
|
|
||||||
Params:
|
Params:
|
||||||
origin: where the events came from
|
|
||||||
room_id: the room that the events are meant to be in (though this has
|
room_id: the room that the events are meant to be in (though this has
|
||||||
not yet been checked)
|
not yet been checked)
|
||||||
events: the events that have been fetched
|
events: the events that have been fetched
|
||||||
@ -1167,15 +1164,15 @@ class FederationEventHandler:
|
|||||||
shortstr(e.event_id for e in roots),
|
shortstr(e.event_id for e in roots),
|
||||||
)
|
)
|
||||||
|
|
||||||
await self._auth_and_persist_fetched_events_inner(origin, room_id, roots)
|
await self._auth_and_persist_outliers_inner(room_id, roots)
|
||||||
|
|
||||||
for ev in roots:
|
for ev in roots:
|
||||||
del event_map[ev.event_id]
|
del event_map[ev.event_id]
|
||||||
|
|
||||||
async def _auth_and_persist_fetched_events_inner(
|
async def _auth_and_persist_outliers_inner(
|
||||||
self, origin: str, room_id: str, fetched_events: Collection[EventBase]
|
self, room_id: str, fetched_events: Collection[EventBase]
|
||||||
) -> None:
|
) -> None:
|
||||||
"""Helper for _auth_and_persist_fetched_events
|
"""Helper for _auth_and_persist_outliers
|
||||||
|
|
||||||
Persists a batch of events where we have (theoretically) already persisted all
|
Persists a batch of events where we have (theoretically) already persisted all
|
||||||
of their auth events.
|
of their auth events.
|
||||||
@ -1719,9 +1716,7 @@ class FederationEventHandler:
|
|||||||
for s in seen_remotes:
|
for s in seen_remotes:
|
||||||
remote_event_map.pop(s, None)
|
remote_event_map.pop(s, None)
|
||||||
|
|
||||||
await self._auth_and_persist_fetched_events(
|
await self._auth_and_persist_outliers(room_id, remote_event_map.values())
|
||||||
destination, room_id, remote_event_map.values()
|
|
||||||
)
|
|
||||||
|
|
||||||
async def _update_context_for_auth_events(
|
async def _update_context_for_auth_events(
|
||||||
self, event: EventBase, context: EventContext, auth_events: StateMap[EventBase]
|
self, event: EventBase, context: EventContext, auth_events: StateMap[EventBase]
|
||||||
|
Loading…
Reference in New Issue
Block a user