Skip to content
Snippets Groups Projects
Unverified Commit 43f1c824 authored by Patrick Cloke's avatar Patrick Cloke Committed by GitHub
Browse files

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.
parent 626afd7e
No related branches found
No related tags found
No related merge requests found
Fix a bug introduced in v1.27.0: "TypeError: int() argument must be a string, a bytes-like object or a number, not 'NoneType." related to the user directory.
...@@ -143,6 +143,10 @@ class UserDirectoryHandler(StateDeltasHandler): ...@@ -143,6 +143,10 @@ class UserDirectoryHandler(StateDeltasHandler):
if self.pos is None: if self.pos is None:
self.pos = await self.store.get_user_directory_stream_pos() 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 # Loop round handling deltas until we're up to date
while True: while True:
with Measure(self.clock, "user_dir_delta"): with Measure(self.clock, "user_dir_delta"):
......
...@@ -707,7 +707,13 @@ class UserDirectoryStore(UserDirectoryBackgroundUpdateStore): ...@@ -707,7 +707,13 @@ class UserDirectoryStore(UserDirectoryBackgroundUpdateStore):
return {row["room_id"] for row in rows} 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( return await self.db_pool.simple_select_one_onecol(
table="user_directory_stream_pos", table="user_directory_stream_pos",
keyvalues={}, keyvalues={},
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment