summary refs log tree commit diff
path: root/synapse/storage/databases/main/pusher.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix the 'set_device_id_for_pushers_txn' background update. (#15391)Quentin Gliech2023-04-051-1/+1
| | | | Refer to the correct field from the response when updating the background update progress.
* Bump ruff from 0.0.252 to 0.0.259 (#15328)dependabot[bot]2023-03-281-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | * Bump ruff from 0.0.252 to 0.0.259 Bumps [ruff](https://github.com/charliermarsh/ruff) from 0.0.252 to 0.0.259. - [Release notes](https://github.com/charliermarsh/ruff/releases) - [Changelog](https://github.com/charliermarsh/ruff/blob/main/BREAKING_CHANGES.md) - [Commits](https://github.com/charliermarsh/ruff/compare/v0.0.252...v0.0.259) --- updated-dependencies: - dependency-name: ruff dependency-type: direct:development update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com> * Fix new warnings * Mypy * Newsfile --------- Signed-off-by: dependabot[bot] <support@github.com> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Make cleaning up pushers depend on the device_id instead of the token_id ↵Quentin Gliech2023-03-241-9/+31
| | | | | | | | | | | | | | (#15280) This makes it so that we rely on the `device_id` to delete pushers on logout, instead of relying on the `access_token_id`. This ensures we're not removing pushers on token refresh, and prepares for a world without access token IDs (also known as the OIDC). This actually runs the `set_device_id_for_pushers` background update, which was forgotten in #13831. Note that for backwards compatibility it still deletes pushers based on the `access_token` until the background update finishes.
* Combine AbstractStreamIdTracker and AbstractStreamIdGenerator. (#15192)Patrick Cloke2023-03-031-2/+1
| | | | | AbstractStreamIdTracker (now) has only a single sub-class: AbstractStreamIdGenerator, combine them to simplify some code and remove any direct references to AbstractStreamIdTracker.
* Bump black from 22.12.0 to 23.1.0 (#15103)dependabot[bot]2023-02-221-3/+0
|
* Always notify replication when a stream advances (#14877)Erik Johnston2023-01-201-0/+1
| | | This ensures that all other workers are told about stream updates in a timely manner, without having to remember to manually poke replication.
* Update all stream IDs after processing replication rows (#14723)Nick Mills-Barrett2023-01-041-3/+3
| | | | | | | | | | | | | | This creates a new store method, `process_replication_position` that is called after `process_replication_rows`. By moving stream ID advances here this guarantees any relevant cache invalidations will have been applied before the stream is advanced. This avoids race conditions where Python switches between threads mid way through processing the `process_replication_rows` method where stream IDs may be advanced before caches are invalidated due to class resolution ordering. See this comment/issue for further discussion: https://github.com/matrix-org/synapse/issues/14158#issuecomment-1344048703
* Remove option to skip locking of tables during emulated upserts (#14469)Sean Quah2022-11-281-6/+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>
* Reintroduce #14376, with bugfix for monoliths (#14468)David Robertson2022-11-161-15/+9
| | | | | | | | | | | | | | | | | | | | | | * Add tests for StreamIdGenerator * Drive-by: annotate all defs * Revert "Revert "Remove slaved id tracker (#14376)" (#14463)" This reverts commit d63814fd736fed5d3d45ff3af5e6d3bfae50c439, which in turn reverted 36097e88c4da51fce6556a58c49bd675f4cf20ab. This restores the latter. * Fix StreamIdGenerator not handling unpersisted IDs Spotted by @erikjohnston. Closes #14456. * Changelog Co-authored-by: Nick Mills-Barrett <nick@fizzadar.com> Co-authored-by: Erik Johnston <erik@matrix.org>
* Revert "Remove slaved id tracker (#14376)" (#14463)Erik Johnston2022-11-161-9/+15
| | | This reverts commit 36097e88c4da51fce6556a58c49bd675f4cf20ab.
* Remove slaved id tracker (#14376)Nick Mills-Barrett2022-11-141-15/+9
| | | | | This matches the multi instance writer ID generator class which can both handle advancing the current token over replication and by calling the database.
* Merge/remove `Slaved*` stores into `WorkerStores` (#14375)Nick Mills-Barrett2022-11-111-6/+35
|
* Track device IDs for pushers (#13831)Brendan Abolivier2022-09-211-2/+71
| | | Second half of the MSC3881 implementation
* Support enabling/disabling pushers (from MSC3881) (#13799)Brendan Abolivier2022-09-211-24/+45
| | | Partial implementation of MSC3881
* Fix invite notifications for users without pushers (#12840)DeepBlueV7.X2022-05-301-6/+0
| | | | Signed-off-by: Nicolas Werner <nicolas.werner@hotmail.de> Co-authored-by: Brendan Abolivier <github@brendanabolivier.com>
* Add some type hints to datastore (#12485)Dirk Klimpel2022-04-271-15/+34
|
* Replace uses of simple_insert_many with simple_insert_many_values. (#11742)Patrick Cloke2022-01-131-6/+2
| | | | This should be (slightly) more efficient and it is simpler to have a single method for inserting multiple values.
* Improve type hints in storage classes. (#11652)Dirk Klimpel2021-12-291-3/+3
| | | By using cast and making ignores more specific.
* Require Collections as the parameters for simple_* methods. (#11580)Patrick Cloke2021-12-151-22/+1
| | | | Instead of Iterable since the generators are not allowed due to the potential for their re-use.
* Annotate synapse.storage.util (#10892)David Robertson2021-10-081-3/+7
| | | | | Also mark `synapse.streams` as having has no untyped defs Co-authored-by: Sean Quah <8349537+squahtx@users.noreply.github.com>
* Fix remove_stale_pushers job on SQLite. (#10843)reivilibre2021-09-201-2/+2
|
* Fix iteration in _remove_deleted_email_pushers background job. (#10734)Andrew Morgan2021-09-011-1/+2
|
* Remove pushers when deleting 3pid from account (#10581)Azrenbeth2021-08-261-0/+72
| | | | | When a user deletes an email from their account it will now also remove all pushers for that email and that user (even if these pushers were created by a different client)
* 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
|
* Make deleting stale pushers a background update (#9536)Erik Johnston2021-03-031-0/+52
|
* Fix SQL delta file taking a long time to run (#9516)Erik Johnston2021-03-021-0/+53
| | | | Fixes #9504
* Ensure pushers are deleted for deactivated accounts (#9285)Erik Johnston2021-02-251-0/+43
|
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-2/+5
| | | | | | | - 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
* Don't error if deleting a non-existent pusher. (#9121)Patrick Cloke2021-01-251-1/+3
|
* Ensure we store pusher data as text (#9117)Richard van der Hoff2021-01-151-3/+2
| | | | | I don't think there's any need to use canonicaljson here. Fixes: #4475.
* Convert internal pusher dicts to attrs classes. (#8940)Patrick Cloke2020-12-161-36/+57
| | | This improves type hinting and should use less memory.
* 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
* Use `async with` for ID gens (#8383)Erik Johnston2020-09-231-2/+2
| | | This will allow us to hit the DB after we've finished using the generated stream ID.
* Make StreamIdGen `get_next` and `get_next_mult` async (#8161)Erik Johnston2020-08-251-2/+2
| | | | This is mainly so that `StreamIdGenerator` and `MultiWriterIdGenerator` will have the same interface, allowing them to be used interchangeably.
* Convert pusher databases to async/await. (#8075)Patrick Cloke2020-08-141-49/+46
|
* Convert misc database code to async (#8087)Patrick Cloke2020-08-141-6/+3
|
* Rename database classes to make some sense (#8033)Erik Johnston2020-08-051-0/+356