summary refs log tree commit diff
path: root/changelog.d
diff options
context:
space:
mode:
authorAndrew Morgan <1342360+anoadragon453@users.noreply.github.com>2020-11-25 20:06:13 +0000
committerGitHub <noreply@github.com>2020-11-25 20:06:13 +0000
commitd963c69ba56ea45276ec3d11d191a20e8a38881d (patch)
tree0330ea185df54f65e44665a6d5e95fb2c777a999 /changelog.d
parentAdd additional type hints to HTTP client. (#8812) (diff)
downloadsynapse-d963c69ba56ea45276ec3d11d191a20e8a38881d.tar.xz
Speed up remote invite rejection database call (#8815)
This is another PR that grew out of #6739.

The existing code for checking whether a user is currently invited to a room when they want to leave the room looks like the following:

https://github.com/matrix-org/synapse/blob/f737368a26bb9eea401fcc3a5bdd7e0b59e91f09/synapse/handlers/room_member.py#L518-L540

It calls `get_invite_for_local_user_in_room`, which will actually query *all* rooms the user has been invited to, before iterating over them and matching via the room ID. It will then return a tuple of a lot of information which we pull the event ID out of.

I need to do a similar check for knocking, but this code wasn't very efficient. I then tried to write a different implementation using `StateHandler.get_current_state` but this actually didn't work as we haven't *joined* the room yet - we've only been invited to it. That means that only certain tables in Synapse have our desired `invite` membership state. One of those tables is `local_current_membership`.

So I wrote a store method that just queries that table instead
Diffstat (limited to 'changelog.d')
-rw-r--r--changelog.d/8815.misc1
1 files changed, 1 insertions, 0 deletions
diff --git a/changelog.d/8815.misc b/changelog.d/8815.misc
new file mode 100644
index 0000000000..647edeb568
--- /dev/null
+++ b/changelog.d/8815.misc
@@ -0,0 +1 @@
+Optimise the lookup for an invite from another homeserver when trying to reject it.
\ No newline at end of file