mirror of
https://github.com/element-hq/synapse.git
synced 2026-05-13 19:23:12 +00:00
Constrain profile endpoint handling to profile_updates writer workers
And update relevant documentation/integration test config.
This commit is contained in:
@@ -60,12 +60,13 @@ if [[ -n "$SYNAPSE_COMPLEMENT_USE_WORKERS" ]]; then
|
||||
federation_inbound, \
|
||||
federation_reader, \
|
||||
federation_sender, \
|
||||
profile_updates, \
|
||||
synchrotron, \
|
||||
client_reader, \
|
||||
appservice, \
|
||||
pusher, \
|
||||
device_lists:2, \
|
||||
stream_writers=account_data+presence+receipts+to_device+typing"
|
||||
stream_writers=account_data+presence+profile_updates+receipts+to_device+typing"
|
||||
|
||||
fi
|
||||
log "Workers requested: $SYNAPSE_WORKER_TYPES"
|
||||
|
||||
@@ -308,6 +308,15 @@ WORKERS_CONFIG: dict[str, dict[str, Any]] = {
|
||||
"shared_extra_conf": {},
|
||||
"worker_extra_conf": "",
|
||||
},
|
||||
"profile_updates": {
|
||||
"app": "synapse.app.generic_worker",
|
||||
"listener_resources": ["client", "replication"],
|
||||
"endpoint_patterns": [
|
||||
"^/_matrix/client/(unstable/uk.tcpip.msc4133|api/v1|r0|v3|unstable)/profile/.*/"
|
||||
],
|
||||
"shared_extra_conf": {},
|
||||
"worker_extra_conf": "",
|
||||
},
|
||||
"device_lists": {
|
||||
"app": "synapse.app.generic_worker",
|
||||
"listener_resources": ["client", "replication"],
|
||||
@@ -517,6 +526,7 @@ def add_worker_roles_to_shared_config(
|
||||
"typing",
|
||||
"push_rules",
|
||||
"thread_subscriptions",
|
||||
"profile_updates",
|
||||
}
|
||||
|
||||
# Worker-type specific sharding config. Now a single worker can fulfill multiple
|
||||
|
||||
@@ -117,6 +117,34 @@ each upgrade are complete before moving on to the next upgrade, to avoid
|
||||
stacking them up. You can monitor the currently running background updates with
|
||||
[the Admin API](usage/administration/admin_api/background_updates.html#status).
|
||||
|
||||
# Upgrading to v1.151.0
|
||||
|
||||
## Profile Updates Stream Writer Workers
|
||||
|
||||
This version of Synapse adds a new `profile_updates` writer stream. The
|
||||
following endpoints may now only be handled by either the main process, or a
|
||||
worker that is designed a "profile_updates" writer. If you are already routing
|
||||
the following endpoints to a worker:
|
||||
|
||||
```
|
||||
/_matrix/client/(api/v1|r0|v3)/profile/<user_id>/(<field_name>?)
|
||||
/_matrix/client/unstable/uk.tcpip.msc4133/profile/<user_id>/(<field_name>?)
|
||||
```
|
||||
|
||||
those worker(s) need to be marked as a stream writer for the `profile_updates`
|
||||
stream in the shared config, using the
|
||||
[`stream_writers`](https://element-hq.github.io/synapse/v1.151/usage/configuration/config_documentation.html#stream_writers)
|
||||
config option:
|
||||
|
||||
```yaml
|
||||
stream_writers:
|
||||
profile_updates: worker1
|
||||
```
|
||||
|
||||
as well as included in the
|
||||
[`instance_map`](https://element-hq.github.io/synapse/v1.151/usage/configuration/config_documentation.html#instance_map)
|
||||
config option.
|
||||
|
||||
# Upgrading to v1.150.0
|
||||
|
||||
## Removal of the `systemd` pip extra
|
||||
|
||||
@@ -4475,6 +4475,8 @@ This setting has the following sub-options:
|
||||
|
||||
* `device_lists` (string): Name of a worker assigned to the `device_lists` stream.
|
||||
|
||||
* `profile_updates` (string): Name of a worker assigned to the `profile_updates` stream.
|
||||
|
||||
Example configuration:
|
||||
```yaml
|
||||
stream_writers:
|
||||
|
||||
@@ -5522,6 +5522,9 @@ properties:
|
||||
device_lists:
|
||||
type: string
|
||||
description: Name of a worker assigned to the `device_lists` stream.
|
||||
profile_updates:
|
||||
type: string
|
||||
description: Name of a worker assigned to the `profile_updates` stream.
|
||||
default: {}
|
||||
examples:
|
||||
- events: worker1
|
||||
|
||||
@@ -284,8 +284,17 @@ class UnstableProfileFieldRestServlet(ProfileFieldRestServlet):
|
||||
|
||||
|
||||
def register_servlets(hs: "HomeServer", http_server: HttpServer) -> None:
|
||||
# The specific field endpoint *must* appear before the generic profile endpoint.
|
||||
ProfileFieldRestServlet(hs).register(http_server)
|
||||
# Updating user profiles requires the ability to write to the
|
||||
# `profile_updates` stream.
|
||||
if hs.get_instance_name() in hs.config.worker.writers.profile_updates:
|
||||
# The specific field endpoint *must* appear before the generic profile
|
||||
# endpoint (below).
|
||||
|
||||
# TODO: Is it possible to still allow any generic_worker to handle the
|
||||
# `GET` endpoint?
|
||||
ProfileFieldRestServlet(hs).register(http_server)
|
||||
|
||||
if hs.config.experimental.msc4133_enabled:
|
||||
UnstableProfileFieldRestServlet(hs).register(http_server)
|
||||
|
||||
ProfileRestServlet(hs).register(http_server)
|
||||
if hs.config.experimental.msc4133_enabled:
|
||||
UnstableProfileFieldRestServlet(hs).register(http_server)
|
||||
|
||||
Reference in New Issue
Block a user