Skip to content
This repository was archived by the owner on Apr 26, 2024. It is now read-only.

Commit 0170774

Browse files
authored
Rename _auth_and_persist_fetched_events (#11116)
... to `_auth_and_persist_outliers`, since that reflects its purpose better.
1 parent d85bc9a commit 0170774

File tree

2 files changed

+10
-14
lines changed

2 files changed

+10
-14
lines changed

changelog.d/11116.misc

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clean up some of the federation event authentication code for clarity.

synapse/handlers/federation_event.py

Lines changed: 9 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -1116,22 +1116,19 @@ async def get_event(event_id: str) -> None:
11161116

11171117
await concurrently_execute(get_event, event_ids, 5)
11181118
logger.info("Fetched %i events of %i requested", len(events), len(event_ids))
1119-
await self._auth_and_persist_fetched_events(destination, room_id, events)
1119+
await self._auth_and_persist_outliers(room_id, events)
11201120

1121-
async def _auth_and_persist_fetched_events(
1122-
self, origin: str, room_id: str, events: Iterable[EventBase]
1121+
async def _auth_and_persist_outliers(
1122+
self, room_id: str, events: Iterable[EventBase]
11231123
) -> None:
1124-
"""Persist the events fetched by _get_events_and_persist or _get_remote_auth_chain_for_event
1125-
1126-
The events to be persisted must be outliers.
1124+
"""Persist a batch of outlier events fetched from remote servers.
11271125
11281126
We first sort the events to make sure that we process each event's auth_events
11291127
before the event itself, and then auth and persist them.
11301128
11311129
Notifies about the events where appropriate.
11321130
11331131
Params:
1134-
origin: where the events came from
11351132
room_id: the room that the events are meant to be in (though this has
11361133
not yet been checked)
11371134
events: the events that have been fetched
@@ -1167,15 +1164,15 @@ async def _auth_and_persist_fetched_events(
11671164
shortstr(e.event_id for e in roots),
11681165
)
11691166

1170-
await self._auth_and_persist_fetched_events_inner(origin, room_id, roots)
1167+
await self._auth_and_persist_outliers_inner(room_id, roots)
11711168

11721169
for ev in roots:
11731170
del event_map[ev.event_id]
11741171

1175-
async def _auth_and_persist_fetched_events_inner(
1176-
self, origin: str, room_id: str, fetched_events: Collection[EventBase]
1172+
async def _auth_and_persist_outliers_inner(
1173+
self, room_id: str, fetched_events: Collection[EventBase]
11771174
) -> None:
1178-
"""Helper for _auth_and_persist_fetched_events
1175+
"""Helper for _auth_and_persist_outliers
11791176
11801177
Persists a batch of events where we have (theoretically) already persisted all
11811178
of their auth events.
@@ -1719,9 +1716,7 @@ async def _get_remote_auth_chain_for_event(
17191716
for s in seen_remotes:
17201717
remote_event_map.pop(s, None)
17211718

1722-
await self._auth_and_persist_fetched_events(
1723-
destination, room_id, remote_event_map.values()
1724-
)
1719+
await self._auth_and_persist_outliers(room_id, remote_event_map.values())
17251720

17261721
async def _update_context_for_auth_events(
17271722
self, event: EventBase, context: EventContext, auth_events: StateMap[EventBase]

0 commit comments

Comments
 (0)