summary refs log tree commit diff
path: root/synapse/types.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2016-06-21 11:36:28 +0100
committerErik Johnston <erik@matrix.org>2016-06-21 11:36:28 +0100
commitcdd379b6df4f9eb3cbfaae2b576538d3d23d38d6 (patch)
treef2d23407520bceecc8b36d59da0368dac4e0b980 /synapse/types.py
parentAlways include tags (diff)
downloadsynapse-cdd379b6df4f9eb3cbfaae2b576538d3d23d38d6.tar.xz
Use msgpack for shorter tokens
Diffstat (limited to 'synapse/types.py')
-rw-r--r--synapse/types.py6
1 files changed, 3 insertions, 3 deletions
diff --git a/synapse/types.py b/synapse/types.py

index 13cdc737fb..e4eddbacef 100644 --- a/synapse/types.py +++ b/synapse/types.py
@@ -19,7 +19,7 @@ from collections import namedtuple from unpaddedbase64 import encode_base64, decode_base64 import ujson as json - +import msgpack Requester = namedtuple("Requester", ["user", "access_token_id", "is_guest"]) @@ -127,7 +127,7 @@ class SyncNextBatchToken( @classmethod def from_string(cls, string): try: - d = json.loads(decode_base64(string)) + d = msgpack.loads(decode_base64(string)) pa = d.get("pa", None) if pa: pa = SyncPaginationState.from_dict(pa) @@ -139,7 +139,7 @@ class SyncNextBatchToken( raise SynapseError(400, "Invalid Token") def to_string(self): - return encode_base64(json.dumps({ + return encode_base64(msgpack.dumps({ "t": self.stream_token.to_arr(), "pa": self.pagination_state.to_dict() if self.pagination_state else None, }))