summary refs log tree commit diff
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2022-11-14 08:13:11 -0500
committerGitHub <noreply@github.com>2022-11-14 08:13:11 -0500
commitfb66fae84b165e7bd132bc7cbc5732485ceee827 (patch)
treec28f4fd1d572dd7497e0f181eb9bc05d8053edcb
parentBump gitpython from 3.1.27 to 3.1.29 (#14429) (diff)
downloadsynapse-fb66fae84b165e7bd132bc7cbc5732485ceee827.tar.xz
Clean-up events persistance code (#14411)
By removing unused variables and making some arguments
required which are always provided.
Diffstat (limited to '')
-rw-r--r--changelog.d/14411.misc1
-rw-r--r--synapse/storage/controllers/persist_events.py2
-rw-r--r--synapse/storage/databases/main/events.py9
3 files changed, 4 insertions, 8 deletions
diff --git a/changelog.d/14411.misc b/changelog.d/14411.misc
new file mode 100644
index 0000000000..f5cca5c833
--- /dev/null
+++ b/changelog.d/14411.misc
@@ -0,0 +1 @@
+Clean-up event persistence code.
diff --git a/synapse/storage/controllers/persist_events.py b/synapse/storage/controllers/persist_events.py
index 06e71a8053..48976dc570 100644
--- a/synapse/storage/controllers/persist_events.py
+++ b/synapse/storage/controllers/persist_events.py
@@ -716,8 +716,6 @@ class EventsPersistenceStorageController:
                             )
                             if not is_still_joined:
                                 logger.info("Server no longer in room %s", room_id)
-                                latest_event_ids = set()
-                                current_state = {}
                                 delta.no_longer_in_room = True
 
                             state_delta_for_room[room_id] = delta
diff --git a/synapse/storage/databases/main/events.py b/synapse/storage/databases/main/events.py
index 00880bb37d..c4acff5be6 100644
--- a/synapse/storage/databases/main/events.py
+++ b/synapse/storage/databases/main/events.py
@@ -355,9 +355,9 @@ class PersistEventsStore:
         txn: LoggingTransaction,
         *,
         events_and_contexts: List[Tuple[EventBase, EventContext]],
-        inhibit_local_membership_updates: bool = False,
-        state_delta_for_room: Optional[Dict[str, DeltaState]] = None,
-        new_forward_extremities: Optional[Dict[str, Set[str]]] = None,
+        inhibit_local_membership_updates: bool,
+        state_delta_for_room: Dict[str, DeltaState],
+        new_forward_extremities: Dict[str, Set[str]],
     ) -> None:
         """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
                 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
 
         min_stream_order = events_and_contexts[0][0].internal_metadata.stream_ordering