From f9af2a16b916a8483ed7f2bc7552949a0f479890 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Fri, 9 Feb 2024 11:10:04 +0100 Subject: [PATCH] :sparkles: Add the ability to create a file snapshot on repair --- backend/src/app/srepl/main.clj | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/backend/src/app/srepl/main.clj b/backend/src/app/srepl/main.clj index 6ee85ad55..b7dd96258 100644 --- a/backend/src/app/srepl/main.clj +++ b/backend/src/app/srepl/main.clj @@ -405,11 +405,11 @@ (d/index-by :id))] (cfv/validate-file file libs))))) -(defn repair-file* +(defn- repair-file* "Internal helper for validate and repair the file. The operation is applied multiple times untile file is fixed or max iteration counter is reached (default 10)" - [system id & {:keys [max-iterations] :or {max-iterations 10}}] + [system id & {:keys [max-iterations label] :or {max-iterations 10}}] (let [id (parse-uuid id) validate-and-repair @@ -440,6 +440,9 @@ (db/tx-run! system (fn [{:keys [::db/conn] :as system}] + (when (string? label) + (fsnap/take-file-snapshot! system {:file-id id :label label})) + (let [file (h/get-file system id) libs (->> (files/get-file-libraries conn id) (into [file] (map (fn [{:keys [id]}]