From 8852ed815faa79c48ef3d2878feaefa6988d41ee Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Thu, 10 Nov 2022 09:43:13 +0100 Subject: [PATCH] :bug: Fix unexpected exception on file-gc cron task --- backend/src/app/tasks/file_gc.clj | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/backend/src/app/tasks/file_gc.clj b/backend/src/app/tasks/file_gc.clj index fa1b68c18..81d14eeca 100644 --- a/backend/src/app/tasks/file_gc.clj +++ b/backend/src/app/tasks/file_gc.clj @@ -44,10 +44,10 @@ (defmethod ig/init-key ::handler [_ {:keys [pool] :as cfg}] - (fn [{:keys [id] :as params}] + (fn [{:keys [file-id] :as params}] (db/with-atomic [conn pool] (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 files (retrieve-candidates cfg)] (if-let [file (first files)] @@ -84,11 +84,11 @@ for update skip locked") (defn- retrieve-candidates - [{:keys [conn min-age id] :as cfg}] - (if id + [{:keys [conn min-age file-id] :as cfg}] + (if (uuid? file-id) (do - (l/warn :hint "explicit file id passed on params" :id id) - (->> (db/query conn :file {:id id}) + (l/warn :hint "explicit file id passed on params" :file-id file-id) + (->> (db/query conn :file {:id file-id}) (map #(update % :features db/decode-pgarray #{})))) (let [interval (db/interval min-age) get-chunk (fn [cursor]