From 0117a4767df7004063fdacddd5dd2fdfd1331af6 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Mon, 2 Sep 2024 11:52:19 +0200 Subject: [PATCH] :paperclip: Rename `file-snapshot` to `auto-file-snapshot` --- backend/src/app/config.clj | 12 ++++++------ backend/src/app/rpc/commands/files_update.clj | 8 ++++---- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/backend/src/app/config.clj b/backend/src/app/config.clj index 578f1db9a..a06f52950 100644 --- a/backend/src/app/config.clj +++ b/backend/src/app/config.clj @@ -42,9 +42,9 @@ :rpc-rlimit-config "resources/rlimit.edn" :rpc-climit-config "resources/climit.edn" - :file-snapshot-total 10 - :file-snapshot-every 5 - :file-snapshot-timeout "3h" + :auto-file-snapshot-total 10 + :auto-file-snapshot-every 5 + :auto-file-snapshot-timeout "3h" :public-uri "http://localhost:3449" :host "localhost" @@ -101,9 +101,9 @@ [:telemetry-uri {:optional true} :string] [:telemetry-with-taiga {:optional true} ::sm/boolean] ;; DELETE - [:file-snapshot-total {:optional true} ::sm/int] - [:file-snapshot-every {:optional true} ::sm/int] - [:file-snapshot-timeout {:optional true} ::dt/duration] + [:auto-file-snapshot-total {:optional true} ::sm/int] + [:auto-file-snapshot-every {:optional true} ::sm/int] + [:auto-file-snapshot-timeout {:optional true} ::dt/duration] [:media-max-file-size {:optional true} ::sm/int] [:deletion-delay {:optional true} ::dt/duration] ;; REVIEW diff --git a/backend/src/app/rpc/commands/files_update.clj b/backend/src/app/rpc/commands/files_update.clj index e4114a2be..007b3b68a 100644 --- a/backend/src/app/rpc/commands/files_update.clj +++ b/backend/src/app/rpc/commands/files_update.clj @@ -388,9 +388,9 @@ (defn- take-snapshot? "Defines the rule when file `data` snapshot should be saved." [{:keys [revn modified-at] :as file}] - (when (contains? cf/flags :file-snapshot) - (let [freq (or (cf/get :file-snapshot-every) 20) - timeout (or (cf/get :file-snapshot-timeout) + (when (contains? cf/flags :auto-file-snapshot) + (let [freq (or (cf/get :auto-file-snapshot-every) 20) + timeout (or (cf/get :auto-file-snapshot-timeout) (dt/duration {:hours 1}))] (or (= 1 freq) @@ -420,7 +420,7 @@ (defn- delete-old-snapshots! [{:keys [::db/conn] :as cfg} {:keys [id] :as file}] (when-let [snapshots (not-empty (db/exec! conn [sql:get-latest-snapshots id - (cf/get :file-snapshot-total 10)]))] + (cf/get :auto-file-snapshot-total 10)]))] (let [last-date (-> snapshots peek :created-at) result (db/exec-one! conn [sql:delete-snapshots id last-date])] (l/trc :hint "delete old snapshots" :file-id (str id) :total (db/get-update-count result)))))