summary refs log tree commit diff
path: root/synapse/storage/directory.py
diff options
context:
space:
mode:
authorErik Johnston <erik@matrix.org>2015-04-07 18:05:39 +0100
committerErik Johnston <erik@matrix.org>2015-04-07 18:05:39 +0100
commit4fe95094d1aa9a8a36a32c56d5665ddba825e029 (patch)
treed7e88a7b2ce0d41403c7a7afaff3b44088e60324 /synapse/storage/directory.py
parentRetry on deadlock (diff)
parentupdate leo's contribs a bit (diff)
downloadsynapse-4fe95094d1aa9a8a36a32c56d5665ddba825e029.tar.xz
Merge branch 'develop' of github.com:matrix-org/synapse into mysql
Diffstat (limited to 'synapse/storage/directory.py')
-rw-r--r--synapse/storage/directory.py10
1 files changed, 8 insertions, 2 deletions
diff --git a/synapse/storage/directory.py b/synapse/storage/directory.py
index e31e10186a..cfb2005706 100644
--- a/synapse/storage/directory.py
+++ b/synapse/storage/directory.py
@@ -13,7 +13,7 @@
 # See the License for the specific language governing permissions and
 # limitations under the License.
 
-from ._base import SQLBaseStore
+from ._base import SQLBaseStore, cached
 
 from synapse.api.errors import SynapseError
 
@@ -106,14 +106,19 @@ class DirectoryStore(SQLBaseStore):
                 },
                 desc="create_room_alias_association",
             )
+        self.get_aliases_for_room.invalidate(room_id)
 
+    @defer.inlineCallbacks
     def delete_room_alias(self, room_alias):
-        return self.runInteraction(
+        room_id = yield self.runInteraction(
             "delete_room_alias",
             self._delete_room_alias_txn,
             room_alias,
         )
 
+        self.get_aliases_for_room.invalidate(room_id)
+        defer.returnValue(room_id)
+
     def _delete_room_alias_txn(self, txn, room_alias):
         txn.execute(
             "SELECT room_id FROM room_aliases WHERE room_alias = ?",
@@ -138,6 +143,7 @@ class DirectoryStore(SQLBaseStore):
 
         return room_id
 
+    @cached()
     def get_aliases_for_room(self, room_id):
         return self._simple_select_onecol(
             "room_aliases",