Skip to content
Snippets Groups Projects
Commit 805196fb authored by Slavi Pantaleev's avatar Slavi Pantaleev
Browse files

Avoid no-op media deletes


If there are no media entries to delete,
avoid creating transactions, prepared statements
and unnecessary log entries.

Signed-off-by: default avatarSlavi Pantaleev <slavi@devture.com>
parent f851bc81
No related branches found
No related tags found
No related merge requests found
......@@ -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"
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment