diff options
author | Matthew Hodgson <matthew@arasphere.net> | 2018-03-14 15:38:05 +0000 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-14 15:38:05 +0000 |
commit | 056a6df5462d45eeb4cc9870492f6147677e7213 (patch) | |
tree | a3a4c576bfd2749d297315a9e6b5cd3f53161d87 /synapse/storage/room.py | |
parent | pep8 (diff) | |
parent | Merge pull request #2995 from matrix-org/erikj/enable_membership_worker (diff) | |
download | synapse-056a6df5462d45eeb4cc9870492f6147677e7213.tar.xz |
Merge branch 'develop' into matthew/filter_members
Diffstat (limited to 'synapse/storage/room.py')
-rw-r--r-- | synapse/storage/room.py | 30 |
1 files changed, 17 insertions, 13 deletions
diff --git a/synapse/storage/room.py b/synapse/storage/room.py index 7f2c08d7a6..34ed84ea22 100644 --- a/synapse/storage/room.py +++ b/synapse/storage/room.py @@ -157,6 +157,18 @@ class RoomWorkerStore(SQLBaseStore): "get_public_room_changes", get_public_room_changes_txn ) + @cached(max_entries=10000) + def is_room_blocked(self, room_id): + return self._simple_select_one_onecol( + table="blocked_rooms", + keyvalues={ + "room_id": room_id, + }, + retcol="1", + allow_none=True, + desc="is_room_blocked", + ) + class RoomStore(RoomWorkerStore, SearchStore): @@ -485,18 +497,6 @@ class RoomStore(RoomWorkerStore, SearchStore): else: defer.returnValue(None) - @cached(max_entries=10000) - def is_room_blocked(self, room_id): - return self._simple_select_one_onecol( - table="blocked_rooms", - keyvalues={ - "room_id": room_id, - }, - retcol="1", - allow_none=True, - desc="is_room_blocked", - ) - @defer.inlineCallbacks def block_room(self, room_id, user_id): yield self._simple_insert( @@ -507,7 +507,11 @@ class RoomStore(RoomWorkerStore, SearchStore): }, desc="block_room", ) - self.is_room_blocked.invalidate((room_id,)) + yield self.runInteraction( + "block_room_invalidation", + self._invalidate_cache_and_stream, + self.is_room_blocked, (room_id,), + ) def get_media_mxcs_in_room(self, room_id): """Retrieves all the local and remote media MXC URIs in a given room |