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

Commit fb66fae

Browse files
authored
Clean-up events persistance code (#14411)
By removing unused variables and making some arguments required which are always provided.
1 parent 95f7a65 commit fb66fae

File tree

3 files changed

+4
-8
lines changed

3 files changed

+4
-8
lines changed

changelog.d/14411.misc

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Clean-up event persistence code.

synapse/storage/controllers/persist_events.py

-2
Original file line numberDiff line numberDiff line change
@@ -716,8 +716,6 @@ async def _persist_event_batch(
716716
)
717717
if not is_still_joined:
718718
logger.info("Server no longer in room %s", room_id)
719-
latest_event_ids = set()
720-
current_state = {}
721719
delta.no_longer_in_room = True
722720

723721
state_delta_for_room[room_id] = delta

synapse/storage/databases/main/events.py

+3-6
Original file line numberDiff line numberDiff line change
@@ -355,9 +355,9 @@ def _persist_events_txn(
355355
txn: LoggingTransaction,
356356
*,
357357
events_and_contexts: List[Tuple[EventBase, EventContext]],
358-
inhibit_local_membership_updates: bool = False,
359-
state_delta_for_room: Optional[Dict[str, DeltaState]] = None,
360-
new_forward_extremities: Optional[Dict[str, Set[str]]] = None,
358+
inhibit_local_membership_updates: bool,
359+
state_delta_for_room: Dict[str, DeltaState],
360+
new_forward_extremities: Dict[str, Set[str]],
361361
) -> None:
362362
"""Insert some number of room events into the necessary database tables.
363363
@@ -384,9 +384,6 @@ def _persist_events_txn(
384384
PartialStateConflictError: if attempting to persist a partial state event in
385385
a room that has been un-partial stated.
386386
"""
387-
state_delta_for_room = state_delta_for_room or {}
388-
new_forward_extremities = new_forward_extremities or {}
389-
390387
all_events_and_contexts = events_and_contexts
391388

392389
min_stream_order = events_and_contexts[0][0].internal_metadata.stream_ordering

0 commit comments

Comments
 (0)