Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Reinstate config option for reading old query parm
Browse files Browse the repository at this point in the history
  • Loading branch information
David Robertson committed Jan 16, 2023
1 parent 3fd6858 commit d4a4cd3
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 2 deletions.
2 changes: 1 addition & 1 deletion changelog.d/14839.feature
Original file line number Diff line number Diff line change
@@ -1 +1 @@
Faster joins: always serve a partial join response to servers that request it.
Faster joins: always serve a partial join response to servers that request it with the stable query param.
7 changes: 7 additions & 0 deletions synapse/config/experimental.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,13 @@ def read_config(self, config: JsonDict, **kwargs: Any) -> None:
"msc3202_transaction_extensions", False
)

# MSC3706 (server-side support for partial state in /send_join responses)
# Synapse will always serve partial state responses to requests using the stable
# query parameter `omit_members`. If this flag is set, Synapse will also serve
# partial state responses to requests using the unstable query parameter
# `org.matrix.msc3706.partial_state`.
self.msc3706_enabled: bool = experimental.get("msc3706_enabled", False)

# experimental support for faster joins over federation
# (MSC2775, MSC3706, MSC3895)
# requires a target server that can provide a partial join response (MSC3706)
Expand Down
4 changes: 3 additions & 1 deletion synapse/federation/transport/server/federation.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,7 @@ def __init__(
server_name: str,
):
super().__init__(hs, authenticator, ratelimiter, server_name)
self._read_msc3706_query_param = hs.config.experimental.msc3706_enabled

async def on_PUT(
self,
Expand All @@ -434,12 +435,13 @@ async def on_PUT(
# TODO(paul): assert that event_id parsed from path actually
# match those given in content

partial_state = False
# The stable query parameter wins, if it disagrees with the unstable
# parameter for some reason.
stable_param = parse_boolean_from_args(query, "omit_members", default=None)
if stable_param is not None:
partial_state = stable_param
else:
elif self._read_msc3706_query_param:
partial_state = parse_boolean_from_args(
query, "org.matrix.msc3706.partial_state", default=False
)
Expand Down

0 comments on commit d4a4cd3

Please sign in to comment.