diff options
author | Erik Johnston <erik@matrix.org> | 2017-05-08 15:55:59 +0100 |
---|---|---|
committer | Erik Johnston <erik@matrix.org> | 2017-05-08 15:55:59 +0100 |
commit | 94e6ad71f5445e014f3c9f6c260ab664635c7b59 (patch) | |
tree | bd6c6755a964769c071cdb6e2db5d2993b84401b /synapse/storage/devices.py | |
parent | Comment (diff) | |
download | synapse-94e6ad71f5445e014f3c9f6c260ab664635c7b59.tar.xz |
Invalidate cache on device deletion
Diffstat (limited to 'synapse/storage/devices.py')
-rw-r--r-- | synapse/storage/devices.py | 8 |
1 files changed, 6 insertions, 2 deletions
diff --git a/synapse/storage/devices.py b/synapse/storage/devices.py index 6727861eb5..75c30abc28 100644 --- a/synapse/storage/devices.py +++ b/synapse/storage/devices.py @@ -115,12 +115,14 @@ class DeviceStore(SQLBaseStore): Returns: defer.Deferred """ - return self._simple_delete_one( + self._simple_delete_one( table="devices", keyvalues={"user_id": user_id, "device_id": device_id}, desc="delete_device", ) + self.device_id_exists_cache.invalidate((user_id, device_id)) + def delete_devices(self, user_id, device_ids): """Deletes several devices. @@ -130,13 +132,15 @@ class DeviceStore(SQLBaseStore): Returns: defer.Deferred """ - return self._simple_delete_many( + self._simple_delete_many( table="devices", column="device_id", iterable=device_ids, keyvalues={"user_id": user_id}, desc="delete_devices", ) + for device_id in device_ids: + self.device_id_exists_cache.invalidate((user_id, device_id)) def update_device(self, user_id, device_id, new_display_name=None): """Update a device. |