diff options
author | David Robertson <davidr@element.io> | 2021-09-22 14:21:58 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-09-22 14:21:58 +0100 |
commit | 724aef9a878cebc137c81f3b261bafb9302fb592 (patch) | |
tree | 3cb2a487de6407a2ce5e1991e6ca8945171d0f61 /synapse/storage | |
parent | Extend ModuleApi with the methods we'll need to reject spam based on …IP - ... (diff) | |
download | synapse-724aef9a878cebc137c81f3b261bafb9302fb592.tar.xz |
Opt out of cache expiry for `get_users_who_share_room_with_user` (#10826)
* Allow LruCaches to opt out of time-based expiry * Don't expire `get_users_who_share_room` & friends
Diffstat (limited to 'synapse/storage')
-rw-r--r-- | synapse/storage/databases/main/roommember.py | 11 |
1 files changed, 8 insertions, 3 deletions
diff --git a/synapse/storage/databases/main/roommember.py b/synapse/storage/databases/main/roommember.py index 9beeb96aa9..a4ec6bc328 100644 --- a/synapse/storage/databases/main/roommember.py +++ b/synapse/storage/databases/main/roommember.py @@ -162,7 +162,7 @@ class RoomMemberWorkerStore(EventsWorkerStore): self._check_safe_current_state_events_membership_updated_txn, ) - @cached(max_entries=100000, iterable=True) + @cached(max_entries=100000, iterable=True, prune_unread_entries=False) async def get_users_in_room(self, room_id: str) -> List[str]: return await self.db_pool.runInteraction( "get_users_in_room", self.get_users_in_room_txn, room_id @@ -439,7 +439,7 @@ class RoomMemberWorkerStore(EventsWorkerStore): return results_dict.get("membership"), results_dict.get("event_id") - @cached(max_entries=500000, iterable=True) + @cached(max_entries=500000, iterable=True, prune_unread_entries=False) async def get_rooms_for_user_with_stream_ordering( self, user_id: str ) -> FrozenSet[GetRoomsForUserWithStreamOrdering]: @@ -544,7 +544,12 @@ class RoomMemberWorkerStore(EventsWorkerStore): ) return frozenset(r.room_id for r in rooms) - @cached(max_entries=500000, cache_context=True, iterable=True) + @cached( + max_entries=500000, + cache_context=True, + iterable=True, + prune_unread_entries=False, + ) async def get_users_who_share_room_with_user( self, user_id: str, cache_context: _CacheContext ) -> Set[str]: |