diff options
author | Erik Johnston <erik@matrix.org> | 2022-04-05 14:26:41 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-05 14:26:41 +0100 |
commit | 66053b6bfbc27a6e281655ebca8f2abbee730135 (patch) | |
tree | a81f601ee8d5819ba09b44c00dced2795331a2fc /synapse/storage/databases/main/receipts.py | |
parent | Add type hints to some tests files (#12371) (diff) | |
download | synapse-66053b6bfbc27a6e281655ebca8f2abbee730135.tar.xz |
Prefill more stream change caches. (#12372)
Diffstat (limited to 'synapse/storage/databases/main/receipts.py')
-rw-r--r-- | synapse/storage/databases/main/receipts.py | 13 |
1 files changed, 12 insertions, 1 deletions
diff --git a/synapse/storage/databases/main/receipts.py b/synapse/storage/databases/main/receipts.py index e6f97aeece..332e901dda 100644 --- a/synapse/storage/databases/main/receipts.py +++ b/synapse/storage/databases/main/receipts.py @@ -98,8 +98,19 @@ class ReceiptsWorkerStore(SQLBaseStore): super().__init__(database, db_conn, hs) + max_receipts_stream_id = self.get_max_receipt_stream_id() + receipts_stream_prefill, min_receipts_stream_id = self.db_pool.get_cache_dict( + db_conn, + "receipts_linearized", + entity_column="room_id", + stream_column="stream_id", + max_value=max_receipts_stream_id, + limit=10000, + ) self._receipts_stream_cache = StreamChangeCache( - "ReceiptsRoomChangeCache", self.get_max_receipt_stream_id() + "ReceiptsRoomChangeCache", + min_receipts_stream_id, + prefilled_cache=receipts_stream_prefill, ) def get_max_receipt_stream_id(self) -> int: |