mirror of
https://github.com/penpot/penpot.git
synced 2025-05-14 02:16:37 +02:00
🐛 Fix unexpected exception on file-gc cron task
This commit is contained in:
parent
fde03e21b0
commit
8852ed815f
1 changed files with 6 additions and 6 deletions
|
@ -44,10 +44,10 @@
|
||||||
|
|
||||||
(defmethod ig/init-key ::handler
|
(defmethod ig/init-key ::handler
|
||||||
[_ {:keys [pool] :as cfg}]
|
[_ {:keys [pool] :as cfg}]
|
||||||
(fn [{:keys [id] :as params}]
|
(fn [{:keys [file-id] :as params}]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(let [min-age (or (:min-age params) (:min-age cfg))
|
(let [min-age (or (:min-age params) (:min-age cfg))
|
||||||
cfg (assoc cfg :min-age min-age :conn conn :id id)]
|
cfg (assoc cfg :min-age min-age :conn conn :file-id file-id)]
|
||||||
(loop [total 0
|
(loop [total 0
|
||||||
files (retrieve-candidates cfg)]
|
files (retrieve-candidates cfg)]
|
||||||
(if-let [file (first files)]
|
(if-let [file (first files)]
|
||||||
|
@ -84,11 +84,11 @@
|
||||||
for update skip locked")
|
for update skip locked")
|
||||||
|
|
||||||
(defn- retrieve-candidates
|
(defn- retrieve-candidates
|
||||||
[{:keys [conn min-age id] :as cfg}]
|
[{:keys [conn min-age file-id] :as cfg}]
|
||||||
(if id
|
(if (uuid? file-id)
|
||||||
(do
|
(do
|
||||||
(l/warn :hint "explicit file id passed on params" :id id)
|
(l/warn :hint "explicit file id passed on params" :file-id file-id)
|
||||||
(->> (db/query conn :file {:id id})
|
(->> (db/query conn :file {:id file-id})
|
||||||
(map #(update % :features db/decode-pgarray #{}))))
|
(map #(update % :features db/decode-pgarray #{}))))
|
||||||
(let [interval (db/interval min-age)
|
(let [interval (db/interval min-age)
|
||||||
get-chunk (fn [cursor]
|
get-chunk (fn [cursor]
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue