summary refs log tree commit diff
path: root/synapse/storage/media_repository.py
diff options
context:
space:
mode:
authorErik Johnston <erikj@jki.re>2017-11-08 11:53:27 +0000
committerGitHub <noreply@github.com>2017-11-08 11:53:27 +0000
commit167eb01d830ecc5fbd32800bfc9fdc36fd1a1de0 (patch)
tree314aa48abc707f924bc177837f5b57c74ee2be1c /synapse/storage/media_repository.py
parentMerge pull request #2649 from matrix-org/rav/fix_delta_on_state_res (diff)
parentAvoid no-op media deletes (diff)
downloadsynapse-167eb01d830ecc5fbd32800bfc9fdc36fd1a1de0.tar.xz
Merge pull request #2637 from spantaleev/avoid-noop-media-deletes
Avoid no-op media deletes
Diffstat (limited to 'synapse/storage/media_repository.py')
-rw-r--r--synapse/storage/media_repository.py6
1 files changed, 6 insertions, 0 deletions
diff --git a/synapse/storage/media_repository.py b/synapse/storage/media_repository.py
index 7110a71279..52e5cdad70 100644
--- a/synapse/storage/media_repository.py
+++ b/synapse/storage/media_repository.py
@@ -254,6 +254,9 @@ class MediaRepositoryStore(SQLBaseStore):
         return self.runInteraction("get_expired_url_cache", _get_expired_url_cache_txn)
 
     def delete_url_cache(self, media_ids):
+        if len(media_ids) == 0:
+            return
+
         sql = (
             "DELETE FROM local_media_repository_url_cache"
             " WHERE media_id = ?"
@@ -281,6 +284,9 @@ class MediaRepositoryStore(SQLBaseStore):
         )
 
     def delete_url_cache_media(self, media_ids):
+        if len(media_ids) == 0:
+            return
+
         def _delete_url_cache_media_txn(txn):
             sql = (
                 "DELETE FROM local_media_repository"