mirror of
https://mau.dev/maunium/synapse.git
synced 2024-11-15 14:32:30 +01:00
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: Slavi Pantaleev <slavi@devture.com>
This commit is contained in:
parent
f851bc8182
commit
805196fbeb
1 changed files with 6 additions and 0 deletions
|
@ -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"
|
||||
|
|
Loading…
Reference in a new issue