From ab461ba5604e5930605b902dcbfbfb653de8d2f0 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 12 Aug 2024 11:03:38 +0200 Subject: [PATCH] :bug: Launch offload only if file-gc has processed the file --- backend/src/app/tasks/file_gc.clj | 9 ++++----- 1 file changed, 4 insertions(+), 5 deletions(-) diff --git a/backend/src/app/tasks/file_gc.clj b/backend/src/app/tasks/file_gc.clj index e84e5a450..730dbe8ae 100644 --- a/backend/src/app/tasks/file_gc.clj +++ b/backend/src/app/tasks/file_gc.clj @@ -301,16 +301,15 @@ (try (db/tx-run! cfg (fn [{:keys [::db/conn] :as cfg}] - (let [cfg (update cfg ::sto/storage sto/configure conn) - res (process-file! cfg)] - - (when (contains? cf/flags :tiered-file-data-storage) + (let [cfg (update cfg ::sto/storage sto/configure conn) + processed? (process-file! cfg)] + (when (and processed? (contains? cf/flags :tiered-file-data-storage)) (wrk/submit! (-> cfg (assoc ::wrk/task :offload-file-data) (assoc ::wrk/params props) (assoc ::wrk/priority 10) (assoc ::wrk/delay 1000)))) - res))) + processed?))) (catch Throwable cause (l/err :hint "error on cleaning file"