diff options
author | Patrick Cloke <clokep@users.noreply.github.com> | 2022-05-05 07:51:19 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-05-05 07:51:19 -0400 |
commit | ddc8bba00f06321e0758afaf88a65e190ca4c714 (patch) | |
tree | d8ab34f6662bcbe319759342f61162678635d311 /synapse/storage/databases | |
parent | Fix typo in some instances of enable_registration_token_3pid_bypass. (#12639) (diff) | |
download | synapse-ddc8bba00f06321e0758afaf88a65e190ca4c714.tar.xz |
Remove unused receipt datastore methods. (#12632)
The last usage was removed in 5a1dd297c3ce105a7f516d9d9fe87b94b9d356c8 (#8059).
Diffstat (limited to 'synapse/storage/databases')
-rw-r--r-- | synapse/storage/databases/main/receipts.py | 54 |
1 files changed, 0 insertions, 54 deletions
diff --git a/synapse/storage/databases/main/receipts.py b/synapse/storage/databases/main/receipts.py index 9e3d838eab..d035969a31 100644 --- a/synapse/storage/databases/main/receipts.py +++ b/synapse/storage/databases/main/receipts.py @@ -22,7 +22,6 @@ from typing import ( Iterable, List, Optional, - Set, Tuple, cast, ) @@ -117,33 +116,6 @@ class ReceiptsWorkerStore(SQLBaseStore): """Get the current max stream ID for receipts stream""" return self._receipts_id_gen.get_current_token() - @cached() - async def get_users_with_read_receipts_in_room(self, room_id: str) -> Set[str]: - receipts = await self.get_receipts_for_room(room_id, ReceiptTypes.READ) - return {r["user_id"] for r in receipts} - - @cached() - async def get_receipts_for_room( - self, room_id: str, receipt_type: str - ) -> List[Dict[str, Any]]: - """ - Fetch the event IDs for the latest receipt for all users in a room with the given receipt type. - - Args: - room_id: The room ID to fetch the receipt for. - receipt_type: The receipt type to fetch. - - Returns: - A list of dictionaries, one for each user ID. Each dictionary - contains a user ID and the event ID of that user's latest receipt. - """ - return await self.db_pool.simple_select_list( - table="receipts_linearized", - keyvalues={"room_id": room_id, "receipt_type": receipt_type}, - retcols=("user_id", "event_id"), - desc="get_receipts_for_room", - ) - async def get_last_receipt_event_id_for_user( self, user_id: str, room_id: str, receipt_types: Iterable[str] ) -> Optional[str]: @@ -599,23 +571,6 @@ class ReceiptsWorkerStore(SQLBaseStore): "get_all_updated_receipts", get_all_updated_receipts_txn ) - def _invalidate_get_users_with_receipts_in_room( - self, room_id: str, receipt_type: str, user_id: str - ) -> None: - if receipt_type != ReceiptTypes.READ: - return - - res = self.get_users_with_read_receipts_in_room.cache.get_immediate( - room_id, None, update_metrics=False - ) - - if res and user_id in res: - # We'd only be adding to the set, so no point invalidating if the - # user is already there - return - - self.get_users_with_read_receipts_in_room.invalidate((room_id,)) - def invalidate_caches_for_receipt( self, room_id: str, receipt_type: str, user_id: str ) -> None: @@ -624,8 +579,6 @@ class ReceiptsWorkerStore(SQLBaseStore): self._get_last_receipt_event_id_for_user.invalidate( (user_id, room_id, receipt_type) ) - self._invalidate_get_users_with_receipts_in_room(room_id, receipt_type, user_id) - self.get_receipts_for_room.invalidate((room_id, receipt_type)) def process_replication_rows( self, @@ -842,13 +795,6 @@ class ReceiptsWorkerStore(SQLBaseStore): ) -> None: assert self._can_write_to_receipts - txn.call_after(self.get_receipts_for_room.invalidate, (room_id, receipt_type)) - txn.call_after( - self._invalidate_get_users_with_receipts_in_room, - room_id, - receipt_type, - user_id, - ) txn.call_after( self._get_receipts_for_user_with_orderings.invalidate, (user_id, receipt_type), |