synapse-product/synapse/storage
Andrew Morgan d963c69ba5
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:

f737368a26/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
2020-11-25 20:06:13 +00:00
..
databases Speed up remote invite rejection database call (#8815) 2020-11-25 20:06:13 +00:00
engines Reduce serialization errors in MultiWriterIdGen (#8456) 2020-10-07 15:15:57 +01:00
schema Only run one background update at a time 2020-03-31 17:43:58 +01:00
util Remove racey assertion in MultiWriterIDGenerator (#8530) 2020-10-14 15:40:06 +01:00
__init__.py Make StreamToken.room_key be a RoomStreamToken instance. (#8281) 2020-09-11 12:22:55 +01:00
_base.py Replace DeferredCache with LruCache where possible (#8563) 2020-10-19 12:20:29 +01:00
background_updates.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
database.py Enable reconnection in DB pool (#8726) 2020-11-12 14:26:24 +00:00
keys.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
persist_events.py Fix message duplication if something goes wrong after persisting the event (#8476) 2020-10-13 12:07:56 +01:00
prepare_database.py Add logging on startup/shutdown (#8448) 2020-10-02 15:20:45 +01:00
purge_events.py Stop sub-classing object (#8249) 2020-09-04 06:54:56 -04:00
push_rule.py Move storage classes into a main "data store". 2019-10-21 16:05:06 +01:00
relations.py Use slots in attrs classes where possible (#8296) 2020-09-14 12:50:06 -04:00
roommember.py Add EventStreamPosition type (#8388) 2020-09-24 13:24:17 +01:00
state.py Mypy fixes for synapse.handlers.federation (#8422) 2020-09-29 15:57:36 +01:00
types.py Pre-emptively fix synapse.storage.types.Connection for future mypy release (#8577) 2020-10-17 09:51:38 +01:00