Skip to content
Snippets Groups Projects
Unverified Commit 2de7e263 authored by Richard van der Hoff's avatar Richard van der Hoff Committed by GitHub
Browse files

Ensure we store pusher data as text (#9117)

I don't think there's any need to use canonicaljson here.

Fixes: #4475.
parent 9de6b941
No related branches found
No related tags found
No related merge requests found
Fix corruption of `pushers` data when a postgres bouncer is used.
...@@ -17,14 +17,13 @@ ...@@ -17,14 +17,13 @@
import logging import logging
from typing import TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Optional, Tuple from typing import TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Optional, Tuple
from canonicaljson import encode_canonical_json
from synapse.push import PusherConfig, ThrottleParams from synapse.push import PusherConfig, ThrottleParams
from synapse.storage._base import SQLBaseStore, db_to_json from synapse.storage._base import SQLBaseStore, db_to_json
from synapse.storage.database import DatabasePool from synapse.storage.database import DatabasePool
from synapse.storage.types import Connection from synapse.storage.types import Connection
from synapse.storage.util.id_generators import StreamIdGenerator from synapse.storage.util.id_generators import StreamIdGenerator
from synapse.types import JsonDict from synapse.types import JsonDict
from synapse.util import json_encoder
from synapse.util.caches.descriptors import cached, cachedList from synapse.util.caches.descriptors import cached, cachedList
if TYPE_CHECKING: if TYPE_CHECKING:
...@@ -315,7 +314,7 @@ class PusherStore(PusherWorkerStore): ...@@ -315,7 +314,7 @@ class PusherStore(PusherWorkerStore):
"device_display_name": device_display_name, "device_display_name": device_display_name,
"ts": pushkey_ts, "ts": pushkey_ts,
"lang": lang, "lang": lang,
"data": bytearray(encode_canonical_json(data)), "data": json_encoder.encode(data),
"last_stream_ordering": last_stream_ordering, "last_stream_ordering": last_stream_ordering,
"profile_tag": profile_tag, "profile_tag": profile_tag,
"id": stream_id, "id": stream_id,
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment