summary refs log tree commit diff
diff options
context:
space:
mode:
authorOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-04-07 12:41:40 +0100
committerOlivier Wilkinson (reivilibre) <oliverw@matrix.org>2022-04-07 12:41:40 +0100
commit6eb1bf7feb8508f513a89e0df232481ba479f5eb (patch)
tree8a266418a51f84d336a9691dfd008403ca8fce65
parentMerge remote-tracking branch 'origin/release-v1.56' into matrix-org-hotfixes (diff)
downloadsynapse-6eb1bf7feb8508f513a89e0df232481ba479f5eb.tar.xz
Try using orjson for deserialisation replication messages
-rw-r--r--synapse/replication/tcp/commands.py8
1 files changed, 5 insertions, 3 deletions
diff --git a/synapse/replication/tcp/commands.py b/synapse/replication/tcp/commands.py

index 3654f6c03c..d47841c07c 100644 --- a/synapse/replication/tcp/commands.py +++ b/synapse/replication/tcp/commands.py
@@ -20,8 +20,10 @@ import abc import logging from typing import Optional, Tuple, Type, TypeVar +import orjson + from synapse.replication.tcp.streams._base import StreamRow -from synapse.util import json_decoder, json_encoder +from synapse.util import json_encoder logger = logging.getLogger(__name__) @@ -130,7 +132,7 @@ class RdataCommand(Command): stream_name, instance_name, None if token == "batch" else int(token), - json_decoder.decode(row_json), + orjson.loads(row_json), ) def to_line(self) -> str: @@ -370,7 +372,7 @@ class UserIpCommand(Command): def from_line(cls: Type["UserIpCommand"], line: str) -> "UserIpCommand": user_id, jsn = line.split(" ", 1) - access_token, ip, user_agent, device_id, last_seen = json_decoder.decode(jsn) + access_token, ip, user_agent, device_id, last_seen = orjson.loads(jsn) return cls(user_id, access_token, ip, user_agent, device_id, last_seen)