From 9f29981fa51685c5f9c720ad5f115b63544bbe49 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Hirsch?= Date: Fri, 22 Nov 2024 13:21:25 +0100 Subject: [PATCH 1/4] Remove account data, receipts and presence requests from default regexps for generic_worker POST requests for account data, receipts and presence require the worker to be configured as a stream writer. The regular expressions in the default list don't assume any HTTP method, so if the worker is not a stream writer, the request fails. The stream writer section of the documentation lists the same regexps as the one I'm removing, so people configuring stream writers can still configure their routing properly. More context: https://github.com/element-hq/synapse/issues/17243#issuecomment-2493621645 --- docs/workers.md | 11 ----------- 1 file changed, 11 deletions(-) diff --git a/docs/workers.md b/docs/workers.md index 0116c455bc7..f6e6652cfe1 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -273,17 +273,6 @@ information. ^/_matrix/client/(api/v1|r0|v3|unstable)/knock/ ^/_matrix/client/(api/v1|r0|v3|unstable)/profile/ - # Account data requests - ^/_matrix/client/(r0|v3|unstable)/.*/tags - ^/_matrix/client/(r0|v3|unstable)/.*/account_data - - # Receipts requests - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/receipt - ^/_matrix/client/(r0|v3|unstable)/rooms/.*/read_markers - - # Presence requests - ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ - # User directory search requests ^/_matrix/client/(r0|v3|unstable)/user_directory/search$ From f10c1f48a2b278fa354281841ad03cc41ddfc1c1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Hirsch?= Date: Fri, 22 Nov 2024 13:35:08 +0100 Subject: [PATCH 2/4] Add changelog entry --- changelog.d/17954.doc | 1 + 1 file changed, 1 insertion(+) create mode 100644 changelog.d/17954.doc diff --git a/changelog.d/17954.doc b/changelog.d/17954.doc new file mode 100644 index 00000000000..ff9508db595 --- /dev/null +++ b/changelog.d/17954.doc @@ -0,0 +1 @@ +Removed redundant regular expressions for account data, receipts and presence requests from the documentation on generic_worker. Contributed by @evoL. \ No newline at end of file From 6ff1d12cfd8bf3e71954fb40292cb1d3447eb1fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Rafa=C5=82=20Hirsch?= Date: Fri, 6 Dec 2024 22:04:08 +0100 Subject: [PATCH 3/4] List regexps for account data and presence only for GET requests GET requests can still be handled by any generic worker, not just the stream writer. --- changelog.d/17954.doc | 2 +- docs/workers.md | 7 +++++++ 2 files changed, 8 insertions(+), 1 deletion(-) diff --git a/changelog.d/17954.doc b/changelog.d/17954.doc index ff9508db595..2f18453da5a 100644 --- a/changelog.d/17954.doc +++ b/changelog.d/17954.doc @@ -1 +1 @@ -Removed redundant regular expressions for account data, receipts and presence requests from the documentation on generic_worker. Contributed by @evoL. \ No newline at end of file +Reorganized regular expressions for account data, receipts and presence requests in the documentation on generic_worker. This is because POST requests to those paths require the worker to be configured as a stream writer. Contributed by @evoL. diff --git a/docs/workers.md b/docs/workers.md index f6e6652cfe1..6c614bd6d0b 100644 --- a/docs/workers.md +++ b/docs/workers.md @@ -281,6 +281,13 @@ Additionally, the following REST endpoints can be handled for GET requests: ^/_matrix/client/(api/v1|r0|v3|unstable)/pushrules/ ^/_matrix/client/unstable/org.matrix.msc4140/delayed_events + # Account data requests + ^/_matrix/client/(r0|v3|unstable)/.*/tags + ^/_matrix/client/(r0|v3|unstable)/.*/account_data + + # Presence requests + ^/_matrix/client/(api/v1|r0|v3|unstable)/presence/ + Pagination requests can also be handled, but all requests for a given room must be routed to the same instance. Additionally, care must be taken to ensure that the purge history admin API is not used while pagination requests From 27e1608435a29358afd88b2678dd9760efdcfd8f Mon Sep 17 00:00:00 2001 From: Eric Eastwood Date: Fri, 6 Dec 2024 21:36:39 -0600 Subject: [PATCH 4/4] Update changelog.d/17954.doc --- changelog.d/17954.doc | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/changelog.d/17954.doc b/changelog.d/17954.doc index 2f18453da5a..8986e41e586 100644 --- a/changelog.d/17954.doc +++ b/changelog.d/17954.doc @@ -1 +1 @@ -Reorganized regular expressions for account data, receipts and presence requests in the documentation on generic_worker. This is because POST requests to those paths require the worker to be configured as a stream writer. Contributed by @evoL. +Update `synapse.app.generic_worker` documentation to only recommend `GET` requests for stream writer routes by default, unless the worker is also configured as a stream writer. Contributed by @evoL.