0
0
Fork 1
mirror of https://mau.dev/maunium/synapse.git synced 2024-05-18 11:33:45 +02:00

Clean-up events persistance code (#14411)

By removing unused variables and making some arguments
required which are always provided.
This commit is contained in:
Patrick Cloke 2022-11-14 08:13:11 -05:00 committed by GitHub
parent 95f7a65a56
commit fb66fae84b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 4 additions and 8 deletions

1
changelog.d/14411.misc Normal file
View file

@ -0,0 +1 @@
Clean-up event persistence code.

View file

@ -716,8 +716,6 @@ class EventsPersistenceStorageController:
) )
if not is_still_joined: if not is_still_joined:
logger.info("Server no longer in room %s", room_id) logger.info("Server no longer in room %s", room_id)
latest_event_ids = set()
current_state = {}
delta.no_longer_in_room = True delta.no_longer_in_room = True
state_delta_for_room[room_id] = delta state_delta_for_room[room_id] = delta

View file

@ -355,9 +355,9 @@ class PersistEventsStore:
txn: LoggingTransaction, txn: LoggingTransaction,
*, *,
events_and_contexts: List[Tuple[EventBase, EventContext]], events_and_contexts: List[Tuple[EventBase, EventContext]],
inhibit_local_membership_updates: bool = False, inhibit_local_membership_updates: bool,
state_delta_for_room: Optional[Dict[str, DeltaState]] = None, state_delta_for_room: Dict[str, DeltaState],
new_forward_extremities: Optional[Dict[str, Set[str]]] = None, new_forward_extremities: Dict[str, Set[str]],
) -> None: ) -> None:
"""Insert some number of room events into the necessary database tables. """Insert some number of room events into the necessary database tables.
@ -384,9 +384,6 @@ class PersistEventsStore:
PartialStateConflictError: if attempting to persist a partial state event in PartialStateConflictError: if attempting to persist a partial state event in
a room that has been un-partial stated. a room that has been un-partial stated.
""" """
state_delta_for_room = state_delta_for_room or {}
new_forward_extremities = new_forward_extremities or {}
all_events_and_contexts = events_and_contexts all_events_and_contexts = events_and_contexts
min_stream_order = events_and_contexts[0][0].internal_metadata.stream_ordering min_stream_order = events_and_contexts[0][0].internal_metadata.stream_ordering