summary refs log tree commit diff
path: root/synapse/handlers/user_directory.py
diff options
context:
space:
mode:
authorPatrick Cloke <clokep@users.noreply.github.com>2021-01-26 10:50:21 -0500
committerGitHub <noreply@github.com>2021-01-26 10:50:21 -0500
commit1baab2035265cf2543fe3c0ef5412c1ac0740c7e (patch)
treecb1b9911d3ad794be081378031cfcdc72939f73f /synapse/handlers/user_directory.py
parentDo not require the CAS service URL setting (use public_baseurl instead). (#9199) (diff)
downloadsynapse-1baab2035265cf2543fe3c0ef5412c1ac0740c7e.tar.xz
Add type hints to various handlers. (#9223)
With this change all handlers except the e2e_* ones have
type hints enabled.
Diffstat (limited to 'synapse/handlers/user_directory.py')
-rw-r--r--synapse/handlers/user_directory.py9
1 files changed, 5 insertions, 4 deletions
diff --git a/synapse/handlers/user_directory.py b/synapse/handlers/user_directory.py
index d4651c8348..8aedf5072e 100644
--- a/synapse/handlers/user_directory.py
+++ b/synapse/handlers/user_directory.py
@@ -145,10 +145,6 @@ class UserDirectoryHandler(StateDeltasHandler):
         if self.pos is None:
             self.pos = await self.store.get_user_directory_stream_pos()
 
-        # If still None then the initial background update hasn't happened yet
-        if self.pos is None:
-            return None
-
         # Loop round handling deltas until we're up to date
         while True:
             with Measure(self.clock, "user_dir_delta"):
@@ -233,6 +229,11 @@ class UserDirectoryHandler(StateDeltasHandler):
 
                     if change:  # The user joined
                         event = await self.store.get_event(event_id, allow_none=True)
+                        # It isn't expected for this event to not exist, but we
+                        # don't want the entire background process to break.
+                        if event is None:
+                            continue
+
                         profile = ProfileInfo(
                             avatar_url=event.content.get("avatar_url"),
                             display_name=event.content.get("displayname"),