diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2021-02-18 08:44:19 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-02-18 08:44:19 -0500 |
commit | 43f1c82457e4ce2ef9805829d86dc8791b56bbd5 (patch) | |
tree | a987fddf4b8891ff3de72db56a8af86284e896db /synapse/storage/databases/main | |
parent | Revert "Update workers.md" (diff) | |
download | synapse-43f1c82457e4ce2ef9805829d86dc8791b56bbd5.tar.xz |
Add back the guard against the user directory stream position not existing. (#9428)
As the comment says, this guard was there for when the initial user directory update has yet to happen.
Diffstat (limited to 'synapse/storage/databases/main')
-rw-r--r-- | synapse/storage/databases/main/user_directory.py | 8 |
1 files changed, 7 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/user_directory.py b/synapse/storage/databases/main/user_directory.py index 3a1fe3ed52..63f88eac51 100644 --- a/synapse/storage/databases/main/user_directory.py +++ b/synapse/storage/databases/main/user_directory.py @@ -707,7 +707,13 @@ class UserDirectoryStore(UserDirectoryBackgroundUpdateStore): return {row["room_id"] for row in rows} - async def get_user_directory_stream_pos(self) -> int: + async def get_user_directory_stream_pos(self) -> Optional[int]: + """ + Get the stream ID of the user directory stream. + + Returns: + The stream token or None if the initial background update hasn't happened yet. + """ return await self.db_pool.simple_select_one_onecol( table="user_directory_stream_pos", keyvalues={}, |