element-synapse/synapse
Quentin Gliech 5ea2cf2484
Move device changes off the main process (#18581)
The main goal of this PR is to handle device list changes onto multiple
writers, off the main process, so that we can have logins happening
whilst Synapse is rolling-restarting.

This is quite an intrusive change, so I would advise to review this
commit by commit; I tried to keep the history as clean as possible.

There are a few things to consider:

- the `device_list_key` in stream tokens becomes a
`MultiWriterStreamToken`, which has a few implications in sync and on
the storage layer
- we had a split between `DeviceHandler` and `DeviceWorkerHandler` for
master vs. worker process. I've kept this split, but making it rather
writer vs. non-writer worker, using method overrides for doing
replication calls when needed
- there are a few operations that need to happen on a single worker at a
time. Instead of using cross-worker locks, for now I made them run on
the first writer on the list

---------

Co-authored-by: Eric Eastwood <erice@element.io>
2025-07-18 09:06:14 +02:00
..
_scripts Fix sequence migration for autoincrement tables in synapse_port_db (#18677) 2025-07-17 11:13:36 +01:00
api Start and stop the Tokio runtime with the Twisted reactor (#18691) 2025-07-17 15:15:11 +00:00
app Clean up MetricsResource and Prometheus hacks (#18687) 2025-07-17 11:57:19 -05:00
appservice Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
config Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
crypto Fix fetching signing keys when old_verify_keys is omitted (#17568) 2024-08-14 14:13:56 +01:00
events Allow admins to see soft failed events (if they want to) (#18238) 2025-07-14 16:55:19 +01:00
federation Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
handlers Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
http Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
logging Speed up MAS token introspection (#18357) 2025-06-16 16:41:35 +01:00
media Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
metrics Clean up MetricsResource and Prometheus hacks (#18687) 2025-07-17 11:57:19 -05:00
module_api Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
push Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
replication Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
res Send an email if the address is already bound to an user account (#16819) 2024-04-23 16:45:24 +01:00
rest Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
server_notices Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
spam_checker_api Correctly mention previous copyright (#16820) 2024-01-23 11:26:48 +00:00
state Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
static Update link to the clients webpage, fix #15825 (#15874) 2023-07-06 17:28:09 +02:00
storage Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
streams Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
synapse_rust Start and stop the Tokio runtime with the Twisted reactor (#18691) 2025-07-17 15:15:11 +00:00
types Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
util Refactor cache metrics to be homeserver-scoped (#18604) 2025-07-16 16:04:57 -05:00
__init__.py Remove support for python 3.8 (#17908) 2024-11-06 19:36:01 +00:00
_pydantic_compat.py import pydantic objects from the _pydantic_compat module (#17667) 2024-09-11 21:01:43 +00:00
event_auth.py bugfix: assert we always pass the create event to get_user_power_level (#18545) 2025-06-13 16:32:24 +00:00
notifier.py remove room without listeners from Notifier.room_to_user_streams (#18380) 2025-05-15 18:18:17 +01:00
py.typed Mark Module API error imports as re-exported and mark Synapse as containing type annotations (#11054) 2021-10-13 08:42:41 +01:00
server.py Move device changes off the main process (#18581) 2025-07-18 09:06:14 +02:00
visibility.py Allow admins to see soft failed events (if they want to) (#18238) 2025-07-14 16:55:19 +01:00