Skip to content
This repository has been archived by the owner on Apr 26, 2024. It is now read-only.

Commit

Permalink
Merge pull request #2637 from spantaleev/avoid-noop-media-deletes
Browse files Browse the repository at this point in the history
Avoid no-op media deletes
  • Loading branch information
erikjohnston authored Nov 8, 2017
2 parents 02a9a93 + 805196f commit 167eb01
Showing 1 changed file with 6 additions and 0 deletions.
6 changes: 6 additions & 0 deletions synapse/storage/media_repository.py
Original file line number Diff line number Diff line change
Expand Up @@ -254,6 +254,9 @@ def _get_expired_url_cache_txn(txn):
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 = ?"
Expand Down Expand Up @@ -281,6 +284,9 @@ def _get_url_cache_media_before_txn(txn):
)

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"
Expand Down

0 comments on commit 167eb01

Please sign in to comment.