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

Tag /send_join responses to detect faster joins #14950

Merged
merged 4 commits into from
Jan 31, 2023
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/14950.misc
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Faster joins: tag `v2/send_join/` requests to indicate if they served a partial join response.
2 changes: 2 additions & 0 deletions synapse/federation/federation_server.py
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
)
from synapse.logging.opentracing import (
log_kv,
set_tag,
start_active_span_from_edu,
tag_args,
trace,
Expand Down Expand Up @@ -678,6 +679,7 @@ async def on_send_join_request(
room_id: str,
caller_supports_partial_state: bool = False,
) -> Dict[str, Any]:
set_tag("partial_state", caller_supports_partial_state)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Note that tags are globally searchable. There is an idea (more honoured in the breach than the observance) that tags should use symbolic constants defined in the SynapseTags class, where we can also put a comment giving a good definition of what the tag actually means.

(In this case: does it mean that the request is for a partial state response, or that the response is partial state, or that the room is currently partial-stated, or?)

An alternative is to use log_kv to log a key/value pair. They aren't searchable and therefore there's less need to clearly define their semantics.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In this situation I want something searchable. How does 083a659 look?

await self._room_member_handler._join_rate_per_room_limiter.ratelimit( # type: ignore[has-type]
requester=None,
key=room_id,
Expand Down