mirror of
https://github.com/penpot/penpot.git
synced 2025-05-19 20:56:11 +02:00
🐛 fix fime-media-gc task.
This commit is contained in:
parent
25824629f2
commit
f06264ea0a
1 changed files with 6 additions and 5 deletions
|
@ -100,7 +100,7 @@
|
||||||
(pmg/migrate-data))
|
(pmg/migrate-data))
|
||||||
|
|
||||||
used (collect-used-media data)
|
used (collect-used-media data)
|
||||||
unused (->> (db/query conn :media-object {:file-id id})
|
unused (->> (db/query conn :file-media-object {:file-id id})
|
||||||
(remove #(contains? used (:id %))))]
|
(remove #(contains? used (:id %))))]
|
||||||
|
|
||||||
(log/infof "processing file: id='%s' age='%s' to-delete=%s" id age (count unused))
|
(log/infof "processing file: id='%s' age='%s' to-delete=%s" id age (count unused))
|
||||||
|
@ -113,9 +113,10 @@
|
||||||
(doseq [mobj unused]
|
(doseq [mobj unused]
|
||||||
(log/debugf "deleting media object: id='%s' media-id='%s' thumb-id='%s'"
|
(log/debugf "deleting media object: id='%s' media-id='%s' thumb-id='%s'"
|
||||||
(:id mobj) (:media-id mobj) (:thumbnail-id mobj))
|
(:id mobj) (:media-id mobj) (:thumbnail-id mobj))
|
||||||
(sto/del-object storage (:media-id mobj))
|
;; NOTE: deleting the file-media-object in the database
|
||||||
(sto/del-object storage (:thumbnail-id mobj))
|
;; automatically marks to be deleted the associated storage
|
||||||
;; Mark object as deleted
|
;; objects with the specialized trigger attached
|
||||||
(db/delete! conn :media-object {:id (:id mobj)}))
|
;; to :file-media-object table.
|
||||||
|
(db/delete! conn :file-media-object {:id (:id mobj)}))
|
||||||
|
|
||||||
nil))
|
nil))
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue