From 3814eb89371f21c995cb48aa2904bfc47758c457 Mon Sep 17 00:00:00 2001 From: Nick Barrett Date: Mon, 12 Sep 2022 15:26:52 +0100 Subject: [PATCH] Always set `event_stream_ordering` --- synapse/storage/databases/main/receipts.py | 15 ++++++--------- 1 file changed, 6 insertions(+), 9 deletions(-) diff --git a/synapse/storage/databases/main/receipts.py b/synapse/storage/databases/main/receipts.py index 87d43750f437..76613b0c74d8 100644 --- a/synapse/storage/databases/main/receipts.py +++ b/synapse/storage/databases/main/receipts.py @@ -664,14 +664,6 @@ def _insert_linearized_receipt_txn( self._receipts_stream_cache.entity_has_changed, room_id, stream_id ) - upsert_values: Dict[str, Any] = { - "stream_id": stream_id, - "event_id": event_id, - "data": json_encoder.encode(data), - } - if stream_ordering is not None: - upsert_values["event_stream_ordering"] = stream_ordering - self.db_pool.simple_upsert_txn( txn, table="receipts_linearized", @@ -680,7 +672,12 @@ def _insert_linearized_receipt_txn( "receipt_type": receipt_type, "user_id": user_id, }, - values=upsert_values, + values={ + "stream_id": stream_id, + "event_id": event_id, + "event_stream_ordering": stream_ordering, + "data": json_encoder.encode(data), + }, # receipts_linearized has a unique constraint on # (user_id, room_id, receipt_type), so no need to lock lock=False,