summary refs log tree commit diff
path: root/synapse/storage/databases/main/appservice.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Return read-only collections from `@cached` methods (#13755)Sean Quah2023-02-101-1/+1
| | | | | | | | | | | | | It's important that collections returned from `@cached` methods are not modified, otherwise future retrievals from the cache will return the modified collection. This applies to the return values from `@cached` methods and the values inside the dictionaries returned by `@cachedList` methods. It's not necessary for the dictionaries returned by `@cachedList` methods themselves to be read-only. Signed-off-by: Sean Quah <seanq@matrix.org> Co-authored-by: David Robertson <davidr@element.io>
* Type hints for tests.appservice (#14990)David Robertson2023-02-061-2/+12
| | | | | | | | | | | | | | | | | | | | * Accept a Sequence of events in synapse.appservice This avoids some casts/ignores in the tests I'm about to fixup. It seems that `List[Mock]` is not a subtype of `List[EventBase]`, but `Sequence[Mock]` is a subtype of `Sequence[EventBase]`. So presumably `Mock` is considered a subtype of anything, much like `Any`. * make tests.appservice.test_scheduler pass mypy * Extra hints in tests.appservice.test_scheduler * Extra hints in tests.appservice.test_api * Extra hints in tests.appservice.test_appservice * Disallow untyped defs * Changelog
* Use `device_one_time_keys_count` to match MSC3202 (#14565)Andrew Ferrazzutti2022-11-281-5/+5
| | | | | | | | | | | | | | | | | | | * Use `device_one_time_keys_count` to match MSC3202 Rename the `device_one_time_key_counts` key in responses to `device_one_time_keys_count` to match the name specified by MSC3202. Also change related variable/class names for consistency. Signed-off-by: Andrew Ferrazzutti <andrewf@element.io> * Update changelog.d/14565.misc * Revert name change for `one_time_key_counts` key as this is a different key altogether from `device_one_time_keys_count`, which is used for `/sync` instead of appservice transactions. Signed-off-by: Andrew Ferrazzutti <andrewf@element.io>
* Remove option to skip locking of tables during emulated upserts (#14469)Sean Quah2022-11-281-2/+0
| | | | | | | | | | | | | | | | | | To perform an emulated upsert into a table safely, we must either: * lock the table, * be the only writer upserting into the table * or rely on another unique index being present. When the 2nd or 3rd cases were applicable, we previously avoided locking the table as an optimization. However, as seen in #14406, it is easy to slip up when adding new schema deltas and corrupt the database. The only time we lock when performing emulated upserts is while waiting for background updates on postgres. On sqlite, we do no locking at all. Let's remove the option to skip locking tables, so that we don't shoot ourselves in the foot again. Signed-off-by: Sean Quah <seanq@matrix.org>
* Check appservice user interest against the local users instead of all users ↵Eric Eastwood2022-10-271-2/+15
| | | | (`get_users_in_room` mis-use) (#13958)
* Federation Sender & Appservice Pusher Stream Optimisations (#13251)Nick Mills-Barrett2022-07-151-40/+18
| | | | | | | | | | | | | * Replace `get_new_events_for_appservice` with `get_all_new_events_stream` The functions were near identical and this brings the AS worker closer to the way federation senders work which can allow for multiple workers to handle AS traffic. * Pull received TS alongside events when processing the stream This avoids an extra query -per event- when both federation sender and appservice pusher process events.
* Remove code which updates `application_services_state.last_txn` (#12680)Richard van der Hoff2022-05-171-23/+24
| | | | This column is unused as of #12209, so let's stop writing to it.
* Add some type hints to datastore (#12485)Dirk Klimpel2022-04-271-2/+2
|
* Add some type hints to datastore (#12423)Dirk Klimpel2022-04-121-10/+18
| | | | | | | | | | | | | | | | | | | * Add some type hints to datastore * newsfile * change `Collection` to `List` * refactor return type of `select_users_txn` * correct type hint in `stream.py` * Remove `Optional` in `select_users_txn` * remove not needed return type in `__init__` * Revert change in `get_stream_id_for_event_txn` * Remove import from `Literal`
* Use a sequence to generate AS transaction IDs, drop `last_txn` AS state (#12209)Nick Mills-Barrett2022-04-011-43/+19
| | | | | | | | Switching to a sequence means there's no need to track `last_txn` on the AS state table to generate new TXN IDs. This also means that there is no longer contention between the AS scheduler and AS handler on updates to the `application_services_state` table, which will prevent serialization errors during the complete AS txn transaction.
* Send device list updates to application services (MSC3202) - part 1 (#11881)Andrew Morgan2022-03-301-5/+9
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Start application service stream token tracking from 1 (#12193)Andrew Morgan2022-03-301-1/+2
| | | Co-authored-by: Erik Johnston <erik@matrix.org>
* Add support for MSC3202: sending one-time key counts and fallback key usage ↵reivilibre2022-02-241-2/+31
| | | | | states to Application Services. (#11617) Co-authored-by: Erik Johnston <erik@matrix.org>
* Send to-device messages to application services (#11215)Andrew Morgan2022-02-011-7/+17
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Include `prev_content` field in AS events (#11798)Vaishnav Nair2022-01-261-1/+1
| | | | | | * Include 'prev_content' field in AS events Signed-off-by: Vaishnav Nair <nairvaishnav007@icloud.com> Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Type hint the constructors of the data store classes (#11555)Sean Quah2021-12-131-3/+7
|
* Add type annotations to `tests.storage.test_appservice`. (#11488)reivilibre2021-12-021-3/+3
|
* Clarifications and small fixes to to-device related code (#11247)Andrew Morgan2021-11-091-4/+4
| | | Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Use direct references for some configuration variables (part 3) (#10885)Patrick Cloke2021-09-231-1/+1
| | | | | | | | This avoids the overhead of searching through the various configuration classes by directly referencing the class that the attributes are in. It also improves type hints since mypy can now resolve the types of the configuration variables.
* Use inline type hints in `http/federation/`, `storage/` and `util/` (#10381)Jonathan de Jong2021-07-151-3/+1
|
* 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>`
* Import HomeServer from the proper module. (#9665)Patrick Cloke2021-03-231-1/+1
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-2/+1
| | | | | | | - 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
* Fix error handling around when completing an AS transaction (#8693)Brendan Abolivier2020-10-301-1/+1
|
* Add type hints to application services. (#8655)Patrick Cloke2020-10-281-38/+60
|
* Fix get|set_type_stream_id_for_appservice store functions (#8648)Will Hunt2020-10-261-7/+22
|
* Send some ephemeral events to appservices (#8437)Will Hunt2020-10-151-9/+57
| | | Optionally sends typing, presence, and read receipt information to appservices.
* Simplify super() calls to Python 3 syntax. (#8344)Patrick Cloke2020-09-181-1/+1
| | | | | | | This converts calls like super(Foo, self) -> super(). Generated with: sed -i "" -Ee 's/super\([^\(]+\)/super()/g' **/*.py
* Convert additional database code to async/await. (#8195)Patrick Cloke2020-08-281-9/+6
|
* Convert calls of async database methods to async (#8166)Patrick Cloke2020-08-271-4/+2
|
* Use the JSON encoder without whitespace in more places. (#8124)Patrick Cloke2020-08-201-3/+2
|
* Convert some of the general database methods to async (#8100)Patrick Cloke2020-08-171-1/+1
|
* Convert appservice, group server, profile and more databases to async (#8066)Patrick Cloke2020-08-121-21/+13
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+374