mirror of
https://git.anonymousland.org/anonymousland/synapse.git
synced 2025-08-02 05:06:02 -04:00
Use stable identifiers for faster joins (#14832)
* Use new query param when requesting a partial join * Read new query param when serving partial join * Provide new field names when serving partial joins * Read new field names from partial join response * Changelog
This commit is contained in:
parent
73ff493dfb
commit
52ae80dd1a
6 changed files with 87 additions and 22 deletions
|
@ -357,6 +357,7 @@ class TransportLayerClient:
|
|||
if self._faster_joins_enabled:
|
||||
# lazy-load state on join
|
||||
query_params["org.matrix.msc3706.partial_state"] = "true"
|
||||
query_params["omit_members"] = "true"
|
||||
|
||||
return await self.client.put_json(
|
||||
destination=destination,
|
||||
|
@ -909,6 +910,14 @@ class SendJoinParser(ByteParser[SendJoinResponse]):
|
|||
use_float="True",
|
||||
)
|
||||
)
|
||||
# The stable field name comes last, so it "wins" if the fields disagree
|
||||
self._coros.append(
|
||||
ijson.items_coro(
|
||||
_partial_state_parser(self._response),
|
||||
"members_omitted",
|
||||
use_float="True",
|
||||
)
|
||||
)
|
||||
|
||||
self._coros.append(
|
||||
ijson.items_coro(
|
||||
|
@ -918,6 +927,15 @@ class SendJoinParser(ByteParser[SendJoinResponse]):
|
|||
)
|
||||
)
|
||||
|
||||
# Again, stable field name comes last
|
||||
self._coros.append(
|
||||
ijson.items_coro(
|
||||
_servers_in_room_parser(self._response),
|
||||
"servers_in_room",
|
||||
use_float="True",
|
||||
)
|
||||
)
|
||||
|
||||
def write(self, data: bytes) -> int:
|
||||
for c in self._coros:
|
||||
c.send(data)
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue