Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
typing: check origin server of typing event against room's servers
Browse files Browse the repository at this point in the history
This is also using the partial state approximation if needed so we do
block here.

Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
  • Loading branch information
Mathieu Velten committed Sep 23, 2022
1 parent 03c2bfb commit 7347d8e
Show file tree
Hide file tree
Showing 3 changed files with 157 additions and 12 deletions.
162 changes: 152 additions & 10 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions changelog.d/13830.bugfix
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster room joins: fix typing EDU being stuck because the handler was waiting for the full state in a redundant check.
6 changes: 4 additions & 2 deletions synapse/handlers/typing.py
Original file line number Diff line number Diff line change
Expand Up @@ -362,11 +362,13 @@ async def _recv_edu(self, origin: str, content: JsonDict) -> None:
)
return

domains = await self._storage_controllers.state.get_current_hosts_in_room(
# Let's check that the origin server is in the room before accepting the typing event.
# We don't want to block waiting on a partial state so take the approximation if needed.
domains = await self._storage_controllers.state.get_current_hosts_in_room_or_partial_state_approximation(
room_id
)

if self.server_name in domains:
if user.domain in domains:
logger.info("Got typing update from %s: %r", user_id, content)
now = self.clock.time_msec()
self._member_typing_until[member] = now + FEDERATION_TIMEOUT
Expand Down

0 comments on commit 7347d8e

Please sign in to comment.