summary refs log tree commit diff
path: root/synapse/storage/databases/main/roommember.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Optimise async get event lookups (#13435)Nick Mills-Barrett2022-08-041-1/+1
| | | | | | Still maintains local in memory lookup optimisation, but does any external lookup as part of the deferred that prevents duplicate lookups for the same event at once. This makes the assumption that fetching from an external cache is a non-zero load operation.
* Refactor presence so we can prune user in room caches (#13313)Erik Johnston2022-07-251-15/+68
| | | | | | | | See #10826 and #10786 for context as to why we had to disable pruning on those caches. Now that `get_users_who_share_room_with_user` is called frequently only for presence, we just need to make calls to it less frequent and then we can remove the various levels of caching that is going on.
* Increase batch size of `bulk_get_push_rules` and ↵Shay2022-07-181-1/+1
| | | | `_get_joined_profiles_from_event_ids`. (#13300)
* Improve performance of query ` _get_subset_users_in_room_with_profiles` (#13299)Shay2022-07-181-1/+1
|
* Async get event cache prep (#13242)Nick Mills-Barrett2022-07-151-1/+3
| | | | | Some experimental prep work to enable external event caching based on #9379 & #12955. Doesn't actually move the cache at all, just lays the groundwork for async implemented caches. Signed off by Nick @ Beeper (@Fizzadar)
* Don't pull out state in `compute_event_context` for unconflicted state (#13267)Erik Johnston2022-07-141-27/+8
|
* Don't pull out the full state when calculating push actions (#13078)Erik Johnston2022-07-111-0/+86
|
* Reduce state pulled from DB due to sending typing and receipts over ↵Erik Johnston2022-06-061-0/+37
| | | | | federation (#12964) Reducing the amount of state we pull from the DB is useful as fetching state is expensive in terms of DB, CPU and memory.
* Mutual rooms: Remove dependency on user directory (#12836)Jonathan de Jong2022-05-301-0/+24
|
* allow `on_invalidate=None` in `@cached` methods (#12769)David Robertson2022-05-171-1/+2
|
* Add some type hints to datastore (#12717)Dirk Klimpel2022-05-171-43/+83
|
* Refactor and convert `Linearizer` to async (#12357)Sean Quah2022-04-051-1/+1
| | | | | | | | | | | Refactor and convert `Linearizer` to async. This makes a `Linearizer` cancellation bug easier to fix. Also refactor to use an async context manager, which eliminates an unlikely footgun where code that doesn't immediately use the context manager could forget to release the lock. Signed-off-by: Sean Quah <seanq@element.io>
* Add a configuration to exclude rooms from sync response (#12310)Brendan Abolivier2022-03-301-5/+16
|
* Add cache for `get_membership_from_event_ids` (#12272)Erik Johnston2022-03-251-4/+33
| | | | | This should speed up push rule calculations for rooms with large numbers of local users when the main push rule cache fails. Co-authored-by: reivilibre <oliverw@matrix.org>
* Remove some unused variables/parameters. (#12187)Patrick Cloke2022-03-091-9/+5
|
* Optimise calculating device_list changes in `/sync`. (#11974)Erik Johnston2022-02-151-0/+62
| | | | | | For users with large accounts it is inefficient to calculate the set of users they share a room with (and takes a lot of space in the cache). Instead we can look at users whose devices have changed since the last sync and check if they share a room with the syncing user.
* Use auto_attribs/native type hints for attrs classes. (#11692)Patrick Cloke2022-01-131-3/+3
|
* Type hint the constructors of the data store classes (#11555)Sean Quah2021-12-131-4/+19
|
* Disambiguate queries on `state_key` (#11497)Richard van der Hoff2021-12-021-2/+2
| | | | | We're going to add a `state_key` column to the `events` table, so we need to add some disambiguation to queries which use it.
* Add remaining type hints to `synapse.events`. (#11098)Patrick Cloke2021-11-021-3/+5
|
* Add type hints for most `HomeServer` parameters (#11095)Sean Quah2021-10-221-3/+4
|
* Use direct references for configuration variables (part 4). (#10893)Patrick Cloke2021-09-231-1/+1
|
* Opt out of cache expiry for `get_users_who_share_room_with_user` (#10826)David Robertson2021-09-221-3/+8
| | | | * Allow LruCaches to opt out of time-based expiry * Don't expire `get_users_who_share_room` & friends
* Use direct references for some configuration variables (#10798)Patrick Cloke2021-09-131-1/+1
| | | | Instead of proxying through the magic getter of the RootConfig object. This should be more performant (and is more explicit).
* Easy refactors of the user directory (#10789)David Robertson2021-09-101-0/+5
| | | No functional changes here. This came out as I was working to tackle #5677
* Do not include rooms with an unknown room version in a sync response. (#10644)Patrick Cloke2021-08-191-3/+5
| | | | A user will still see this room if it is in a local cache, but it will not reappear if clearing the cache and reloading.
* Convert room member storage tuples to attrs. (#10629)Patrick Cloke2021-08-181-2/+6
| | | | Instead of using namedtuples. This helps with asserting type hints and code completion.
* Improve event caching code (#10119)Erik Johnston2021-08-041-4/+2
| | | | Ensure we only load an event from the DB once when the same event is requested multiple times at once.
* [pyupgrade] `synapse/` (#10348)Jonathan de Jong2021-07-191-1/+1
| | | | | | | | | This PR is tantamount to running ``` pyupgrade --py36-plus --keep-percent-format `find synapse/ -type f -name "*.py"` ``` Part of #9744
* Show all joinable rooms in the spaces summary. (#10298)Patrick Cloke2021-07-131-2/+11
| | | | | | | | | | Previously only world-readable rooms were shown. This means that rooms which are public, knockable, or invite-only with a pending invitation, are included in a space summary. It also applies the same logic to the experimental room version from MSC3083 -- if a user has access to the proper allowed rooms then it is shown in the spaces summary. This change is made per MSC3173 allowing stripped state of a room to be shown to any potential room joiner.
* Fix incorrect time magnitude on delayed call (#10195)Andrew Morgan2021-06-171-1/+1
| | | | | | | | | Fixes https://github.com/matrix-org/synapse/issues/10030. We were expecting milliseconds where we should have provided a value in seconds. The impact of this bug isn't too bad. The code is intended to count the number of remote servers that the homeserver can see and report that as a metric. This metric is supposed to run initially 1 second after server startup, and every 60s as well. Instead, it ran 1,000 seconds after server startup, and every 60s after startup. This fix allows for the correct metrics to be collected immediately, as well as preventing a random collection 1,000s in the future after startup.
* Use get_current_users_in_room from store and not StateHandler (#9910)Erik Johnston2021-05-051-2/+6
|
* Only store data in caches, not "smart" objects (#9845)Erik Johnston2021-04-231-72/+89
|
* Remove `synapse.types.Collection` (#9856)Richard van der Hoff2021-04-221-2/+12
| | | This is no longer required, since we have dropped support for Python 3.5.
* User directory: use calculated room membership state instead (#9821)Andrew Morgan2021-04-161-0/+27
| | | | | Fixes: #9797. Should help reduce CPU usage on the user directory, especially when memberships change in rooms with lots of state history.
* Remove redundant "coding: utf-8" lines (#9786)Jonathan de Jong2021-04-141-1/+0
| | | | | | | Part of #9744 Removes all redundant `# -*- coding: utf-8 -*-` lines from files, as python 3 automatically reads source code as utf-8 now. `Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>`
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-8/+9
| | | | | | | - Update black version to the latest - Run black auto formatting over the codebase - Run autoformatting according to [`docs/code_style.md `](https://github.com/matrix-org/synapse/blob/80d6dc9783aa80886a133756028984dbf8920168/docs/code_style.md) - Update `code_style.md` docs around installing black to use the correct version
* Use execute_batch in more places (#9188)Erik Johnston2021-01-211-5/+1
| | | | | * Use execute_batch in more places * Newsfile
* Speed up remote invite rejection database call (#8815)Andrew Morgan2020-11-251-1/+33
| | | | | | | | | | | | | 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
* Consistently use wrap_as_background_task in more places (#8599)Patrick Cloke2020-10-201-9/+7
|
* Add `DeferredCache.get_immediate` method (#8568)Richard van der Hoff2020-10-191-1/+1
| | | | | | | | | | | * Add `DeferredCache.get_immediate` method A bunch of things that are currently calling `DeferredCache.get` are only really interested in the result if it's completed. We can optimise and simplify this case. * Remove unused 'default' parameter to DeferredCache.get() * another get_immediate instance
* Move additional tasks to the background worker (#8458)Patrick Cloke2020-10-071-1/+4
|
* Add logging on startup/shutdown (#8448)Erik Johnston2020-10-021-10/+3
| | | | | This is so we can tell what is going on when things are taking a while to start up. The main change here is to ensure that transactions that are created during startup get correctly logged like normal transactions.
* Add EventStreamPosition type (#8388)Erik Johnston2020-09-241-5/+9
| | | | | | | | | | | | | | The idea is to remove some of the places we pass around `int`, where it can represent one of two things: 1. the position of an event in the stream; or 2. a token that partitions the stream, used as part of the stream tokens. The valid operations are then: 1. did a position happen before or after a token; 2. get all events that happened before or after a token; and 3. get all events between two tokens. (Note that we don't want to allow other operations as we want to change the tokens to be vector clocks rather than simple ints)
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-3/+3
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Fix typing for SyncHandler (#8237)Erik Johnston2020-09-031-3/+3
|
* Convert `event_push_actions`, `registration`, and `roommember` datastores to ↵Patrick Cloke2020-08-281-25/+27
| | | | async (#8197)
* Convert some of the general database methods to async (#8100)Patrick Cloke2020-08-171-2/+2
|
* Convert misc database code to async (#8087)Patrick Cloke2020-08-141-11/+6
|
* Convert the roommember database to async/await. (#8070)Patrick Cloke2020-08-121-165/+98
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+1139