-
-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Wait for lazy join to complete when getting current state #12872
Changes from 12 commits
78faa1a
334844d
fe86915
a2465b8
a2945a5
e786f68
3f74b37
c068581
6f386d1
2b674f8
ecae768
d1a1d6a
531955f
6cc7269
3a20548
6e7625e
711ea44
1f99ce0
b59418f
c6fe132
4757b00
b6cb65f
c513c20
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
When querying the current state of the room wait for lazy joining of the room to finish. | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -506,8 +506,8 @@ async def _load_filtered_recents( | |
# ensure that we always include current state in the timeline | ||
current_state_ids: FrozenSet[str] = frozenset() | ||
if any(e.is_state() for e in recents): | ||
current_state_ids_map = await self.store.get_current_state_ids( | ||
room_id | ||
current_state_ids_map = ( | ||
await self.state_storage.get_current_state_ids(room_id) | ||
) | ||
current_state_ids = frozenset(current_state_ids_map.values()) | ||
|
||
|
@@ -574,8 +574,11 @@ async def _load_filtered_recents( | |
# ensure that we always include current state in the timeline | ||
current_state_ids = frozenset() | ||
if any(e.is_state() for e in loaded_recents): | ||
current_state_ids_map = await self.store.get_current_state_ids( | ||
room_id | ||
# FIXME(faster room joins): We use the partial state here as | ||
erikjohnston marked this conversation as resolved.
Show resolved
Hide resolved
|
||
# we don't want to block `/sync` on finishing a lazy join. | ||
# Is this the correct way of doing it? | ||
current_state_ids_map = ( | ||
await self.store.get_partial_current_state_ids(room_id) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is a check to see if the state event we're about to send down to clients is in the current state, and if so to always send it even if There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I'm not really following, but this is something we can return to. |
||
) | ||
current_state_ids = frozenset(current_state_ids_map.values()) | ||
|
||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -77,7 +77,7 @@ def _invalidate_state_caches( | |
|
||
# Purge other caches based on room state. | ||
self._attempt_to_invalidate_cache("get_room_summary", (room_id,)) | ||
self._attempt_to_invalidate_cache("get_current_state_ids", (room_id,)) | ||
self._attempt_to_invalidate_cache("get_partial_current_state_ids", (room_id,)) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this means a rolling restart is unwise. We should either document it, or arrange for it to be safe. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this is fine, as we're actually not streaming the name of the caches over replication for these, we're just sending "invalidate all current state caches kthx" instead. ( There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. ah. yes. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think this means a rolling restart is unwise. We should either document it, or arrange for it to be safe. |
||
|
||
def _attempt_to_invalidate_cache( | ||
self, cache_name: str, key: Optional[Collection[Any]] | ||
|
Uh oh!
There was an error while loading. Please reload this page.