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

Commit 2de7e26

Browse files
authored
Ensure we store pusher data as text (#9117)
I don't think there's any need to use canonicaljson here. Fixes: #4475.
1 parent 9de6b94 commit 2de7e26

File tree

2 files changed

+3
-3
lines changed

2 files changed

+3
-3
lines changed

changelog.d/9117.bugfix

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
Fix corruption of `pushers` data when a postgres bouncer is used.

synapse/storage/databases/main/pusher.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,14 +17,13 @@
1717
import logging
1818
from typing import TYPE_CHECKING, Any, Dict, Iterable, Iterator, List, Optional, Tuple
1919

20-
from canonicaljson import encode_canonical_json
21-
2220
from synapse.push import PusherConfig, ThrottleParams
2321
from synapse.storage._base import SQLBaseStore, db_to_json
2422
from synapse.storage.database import DatabasePool
2523
from synapse.storage.types import Connection
2624
from synapse.storage.util.id_generators import StreamIdGenerator
2725
from synapse.types import JsonDict
26+
from synapse.util import json_encoder
2827
from synapse.util.caches.descriptors import cached, cachedList
2928

3029
if TYPE_CHECKING:
@@ -315,7 +314,7 @@ async def add_pusher(
315314
"device_display_name": device_display_name,
316315
"ts": pushkey_ts,
317316
"lang": lang,
318-
"data": bytearray(encode_canonical_json(data)),
317+
"data": json_encoder.encode(data),
319318
"last_stream_ordering": last_stream_ordering,
320319
"profile_tag": profile_tag,
321320
"id": stream_id,

0 commit comments

Comments
 (0)