summary refs log tree commit diff
path: root/synapse/federation/sender/per_destination_queue.py (follow)
Commit message (Collapse)AuthorAgeFilesLines
* Fix up logic for delaying sending read receipts over federation. (#17933)Erik Johnston2024-11-251-22/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | For context of why we delay read receipts, see https://github.com/matrix-org/synapse/issues/4730. Element Web often sends read receipts in quick succession, if it reloads the timeline it'll send one for the last message in the old timeline and again for the last message in the new timeline. This caused remote users to see a read receipt for older messages come through quickly, but then the second read receipt taking a while to arrive for the most recent message. There are two things going on in this PR: 1. There was a mismatch between seconds and milliseconds, and so we ended up delaying for far longer than intended. 2. Changing the logic to reuse the `DestinationWakeupQueue` (used for presence) The changes in logic are: - Treat the first receipt and subsequent receipts in a room in the same way - Whitelist certain classes of receipts to never delay being sent, i.e. receipts in small rooms, receipts for events that were sent within the last 60s, and sending receipts to the event sender's server. - The maximum delay a receipt can have before being sent to a server is 30s, and we'll send out receipts to remotes at least at 50Hz (by default) The upshot is that this should make receipts feel more snappy over federation. This new logic should send roughly between 10%–20% of transactions immediately on matrix.org.
* Fix exception when failing to talk to remote server (#17411)Erik Johnston2024-07-091-1/+2
| | | Broke in #17381
* Bump ruff from 0.3.7 to 0.5.0 (#17381)dependabot[bot]2024-07-051-2/+0
|
* Limit size of presence EDUs (#17371)Erik Johnston2024-07-011-11/+20
| | | | | | | Otherwise they are unbounded. --------- Co-authored-by: Andrew Morgan <1342360+anoadragon453@users.noreply.github.com>
* Correctly mention previous copyright (#16820)Erik Johnston2024-01-231-0/+2
| | | | | During the migration the automated script to update the copyright headers accidentally got rid of some of the existing copyright lines. Reinstate them.
* Update license headersPatrick Cloke2023-11-211-12/+16
|
* Don't wake up destination transaction queue if they're not due for retry. ↵Erik Johnston2023-09-041-1/+5
| | | | (#16223)
* Ensure fed-sender catchup does not block for full state (#15248)David Robertson2023-03-131-2/+7
| | | | * Reproduce bad scenario in test * Avoid catchup optimisation for partial state rooms
* Refactor `filter_events_for_server` (#15240)David Robertson2023-03-101-0/+2
| | | | | | | | | | | | | | | | | * Tweak docstring and type hint * Flip logic and provide better name * Separate decision from action * Track a set of strings, not EventBases * Require explicit boolean options from callers * Add explicit option for partial state rooms * Changelog * Rename param
* Improve logging and opentracing for to-device message handling (#14598)Richard van der Hoff2022-12-061-1/+1
| | | | | | | A batch of changes intended to make it easier to trace to-device messages through the system. The intention here is that a client can set a property org.matrix.msgid in any to-device message it sends. That ID is then included in any tracing or logging related to the message. (Suggestions as to where this field should be documented welcome. I'm not enthusiastic about speccing it - it's very much an optional extra to help with debugging.) I've also generally improved the data we send to opentracing for these messages.
* Include thread information when sending receipts over federation. (#14466)Patrick Cloke2022-11-281-63/+120
| | | | | | | | | | | | Include the thread_id field when sending read receipts over federation. This might result in the same user having multiple read receipts per-room, meaning multiple EDUs must be sent to encapsulate those receipts. This restructures the PerDestinationQueue APIs to support multiple receipt EDUs, queue_read_receipt now becomes linear time in the number of queued threaded receipts in the room for the given user, it is expected this is a small number since receipt EDUs are sent as filler in transactions.
* Faster joins: filter out non local events when a room doesn't have its full ↵Mathieu Velten2022-11-211-0/+1
| | | | | | state (#14404) Signed-off-by: Mathieu Velten <mathieuv@matrix.org>
* Prioritize outbound to-device over device list updates (#13922)Erik Johnston2022-09-271-13/+16
| | | Otherwise device list changes for large accounts can temporarily delay to-device messages.
* Reduce amount of state we pull out when attempting to send catchup PDUs. ↵Erik Johnston2022-06-071-11/+20
| | | | | | | | | (#12963) * Don't pull out state for catchup * Newsfile * Merge newsfile
* Additional constants for EDU types. (#12884)Patrick Cloke2022-05-271-3/+4
| | | Instead of hard-coding strings in many places.
* Avoid attempting to delete push actions for remote users. (#12879)Patrick Cloke2022-05-261-1/+1
| | | | Remote users will never have push actions, so we can avoid a database round-trip/transaction completely.
* Spread out sending device lists to remote hosts (#12132)Erik Johnston2022-03-041-0/+10
|
* Remove `HomeServer.get_datastore()` (#12031)Richard van der Hoff2022-02-231-4/+5
| | | | | | | The presence of this method was confusing, and mostly present for backwards compatibility. Let's get rid of it. Part of #11733
* Minor typing fixes (#12034)Richard van der Hoff2022-02-211-9/+9
| | | | | | These started failing in https://github.com/matrix-org/synapse/pull/12031... I'm a bit mystified by how they ever worked.
* Use auto_attribs/native type hints for attrs classes. (#11692)Patrick Cloke2022-01-131-6/+6
|
* Add most of the missing type hints to `synapse.federation`. (#11483)Patrick Cloke2021-12-021-3/+10
| | | This skips a few methods which are difficult to type.
* Remove unnecessary parentheses around tuples returned from methods (#10889)Andrew Morgan2021-09-231-2/+2
|
* Stagger send presence to remotes (#10398)Erik Johnston2021-07-151-3/+13
| | | | | | This is to help with performance, where trying to connect to thousands of hosts at once can consume a lot of CPU (due to TLS etc). Co-authored-by: Brendan Abolivier <babolivier@matrix.org>
* Use inline type hints in various other places (in `synapse/`) (#10380)Jonathan de Jong2021-07-151-9/+9
|
* Add debug logging for issue #9533 (#9959)Richard van der Hoff2021-05-111-0/+9
| | | | | Hopefully this will help us track down where to-device messages are getting lost/delayed.
* Revert "Experimental Federation Speedup (#9702)"Andrew Morgan2021-04-281-9/+6
| | | | This reverts commit 05e8c70c059f8ebb066e029bc3aa3e0cefef1019.
* Experimental Federation Speedup (#9702)Jonathan de Jong2021-04-141-6/+9
| | | | | This basically speeds up federation by "squeezing" each individual dual database call (to destinations and destination_rooms), which previously happened per every event, into one call for an entire batch (100 max). Signed-off-by: Jonathan de Jong <jonathan@automatia.nl>
* 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>`
* Improve tracing for to device messages (#9686)Erik Johnston2021-04-011-0/+8
|
* Fixed undefined variable error in catchup (#9664)Erik Johnston2021-03-241-0/+2
| | | | | Broke in #9640 Co-authored-by: Patrick Cloke <clokep@users.noreply.github.com>
* Make federation catchup send last event from any server. (#9640)Erik Johnston2021-03-181-15/+89
| | | | | | | | | | | | | | Currently federation catchup will send the last *local* event that we failed to send to the remote. This can cause issues for large rooms where lots of servers have sent events while the remote server was down, as when it comes back up again it'll be flooded with events from various points in the DAG. Instead, let's make it so that all the servers send the most recent events, even if its not theirs. The remote should deduplicate the events, so there shouldn't be much overhead in doing this. Alternatively, the servers could only send local events if they were also extremities and hope that the other server will send the event over, but that is a bit risky.
* Don't go into federation catch up mode so easily (#9561)Erik Johnston2021-03-151-119/+168
| | | | | | | | | | Federation catch up mode is very inefficient if the number of events that the remote server has missed is small, since handling gaps can be very expensive, c.f. #9492. Instead of going into catch up mode whenever we see an error, we instead do so only if we've backed off from trying the remote for more than an hour (the assumption being that in such a case it is more than a transient failure).
* Update black, and run auto formatting over the codebase (#9381)Eric Eastwood2021-02-161-4/+8
| | | | | | | - 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
* Remove stream ordering from Metadata dict (#8452)Richard van der Hoff2020-10-051-0/+2
| | | | | | | | There's no need for it to be in the dict as well as the events table. Instead, we store it in a separate attribute in the EventInternalMetadata object, and populate that on load. This means that we can rely on it being correctly populated for any event which has been persited to the database.
* Fix malformed log line in new federation "catch up" logic (#8442)Richard van der Hoff2020-10-021-1/+1
|
* Catch-up after Federation Outage (split, 4): catch-up loop (#8272)reivilibre2020-09-151-4/+125
|
* Catch up after Federation Outage (split, 2): Track last successful stream ↵reivilibre2020-09-041-0/+11
| | | | | ordering after transmission (#8247) Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Stop sub-classing object (#8249)Patrick Cloke2020-09-041-1/+1
|
* Remove obsolete order field in `send_new_transaction` (#8245)reivilibre2020-09-031-9/+8
| | | Co-authored-by: Richard van der Hoff <1389908+richvdh@users.noreply.github.com>
* Convert stream database to async/await. (#8074)Patrick Cloke2020-08-171-1/+1
|
* Drop federation transmission queues during a significant remote outage. (#7864)reivilibre2020-08-131-0/+22
| | | | | | | | | | | | | * Empty federation transmission queues when we are backing off. Fixes #7828. Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Address feedback Signed-off-by: Olivier Wilkinson (reivilibre) <olivier@librepush.net> * Reword newsfile
* Update worker docs with recent enhancements (#7969)Erik Johnston2020-07-291-1/+1
|
* Add ability to run multiple pusher instances (#7855)Erik Johnston2020-07-161-1/+1
| | | This reuses the same scheme as federation sender sharding
* Add ability to shard the federation sender (#7798)Erik Johnston2020-07-101-0/+22
|
* Fix some spelling mistakes / typos. (#7811)Patrick Cloke2020-07-091-2/+2
|
* add a commentRichard van der Hoff2020-05-211-0/+3
|
* Fix catchup-on-reconnect for the Federation Stream (#7374)Richard van der Hoff2020-05-051-2/+4
| | | | looks like we managed to break this during the refactorathon.
* Add typing to synapse.federation.sender (#6871)Erik Johnston2020-02-071-43/+45
|
* Add StateMap type alias (#6715)Erik Johnston2020-01-161-1/+2
|
* Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-311-5/+6
|\
| * Update black to 19.10b0 (#6304)Amber Brown2019-11-011-5/+6
| | | | | | * update version of black and also fix the mypy config being overridden
* | rename get_devices_by_remote to get_device_updates_by_remoteHubert Chathi2019-10-301-2/+2
| |
* | Merge branch 'develop' into cross-signing_federationHubert Chathi2019-10-241-1/+1
|\|
| * Move storage classes into a main "data store".Erik Johnston2019-10-211-1/+1
| | | | | | | | | | This is in preparation for having multiple data stores that offer different functionality, e.g. splitting out state or event storage.
* | implement federation parts of cross-signingHubert Chathi2019-10-221-2/+2
|/
* Replace returnValue with return (#5736)Amber Brown2019-07-231-2/+2
|
* Run Black. (#5482)Amber Brown2019-06-201-5/+2
|
* Clean up code for sending federation EDUs. (#5381)Richard van der Hoff2019-06-131-14/+26
| | | | This code confused the hell out of me today. Split _get_new_device_messages into its two (unrelated) parts.
* Prevent multiple device list updates from breaking a batch send (#5156)Andrew Morgan2019-06-061-2/+3
| | | fixes #5153
* Run `black` on per_destination_queueRichard van der Hoff2019-05-091-35/+39
| | | | ... mostly to fix pep8 fails
* Limit the number of EDUs in transactions to 100 as expected by receiver (#5138)Quentin Dufour2019-05-091-26/+30
| | | Fixes #3951.
* Batch up outgoing read-receipts to reduce federation traffic. (#4890)Richard van der Hoff2019-03-201-2/+62
| | | | Rate-limit outgoing read-receipts as per #4730.
* Rename and move the classesRichard van der Hoff2019-03-131-0/+318