mirror of
https://github.com/penpot/penpot.git
synced 2025-03-11 07:11:32 -05:00
📎 Rename file-snapshot
to auto-file-snapshot
This commit is contained in:
parent
d703205921
commit
0117a4767d
2 changed files with 10 additions and 10 deletions
|
@ -42,9 +42,9 @@
|
||||||
:rpc-rlimit-config "resources/rlimit.edn"
|
:rpc-rlimit-config "resources/rlimit.edn"
|
||||||
:rpc-climit-config "resources/climit.edn"
|
:rpc-climit-config "resources/climit.edn"
|
||||||
|
|
||||||
:file-snapshot-total 10
|
:auto-file-snapshot-total 10
|
||||||
:file-snapshot-every 5
|
:auto-file-snapshot-every 5
|
||||||
:file-snapshot-timeout "3h"
|
:auto-file-snapshot-timeout "3h"
|
||||||
|
|
||||||
:public-uri "http://localhost:3449"
|
:public-uri "http://localhost:3449"
|
||||||
:host "localhost"
|
:host "localhost"
|
||||||
|
@ -101,9 +101,9 @@
|
||||||
[:telemetry-uri {:optional true} :string]
|
[:telemetry-uri {:optional true} :string]
|
||||||
[:telemetry-with-taiga {:optional true} ::sm/boolean] ;; DELETE
|
[:telemetry-with-taiga {:optional true} ::sm/boolean] ;; DELETE
|
||||||
|
|
||||||
[:file-snapshot-total {:optional true} ::sm/int]
|
[:auto-file-snapshot-total {:optional true} ::sm/int]
|
||||||
[:file-snapshot-every {:optional true} ::sm/int]
|
[:auto-file-snapshot-every {:optional true} ::sm/int]
|
||||||
[:file-snapshot-timeout {:optional true} ::dt/duration]
|
[:auto-file-snapshot-timeout {:optional true} ::dt/duration]
|
||||||
|
|
||||||
[:media-max-file-size {:optional true} ::sm/int]
|
[:media-max-file-size {:optional true} ::sm/int]
|
||||||
[:deletion-delay {:optional true} ::dt/duration] ;; REVIEW
|
[:deletion-delay {:optional true} ::dt/duration] ;; REVIEW
|
||||||
|
|
|
@ -388,9 +388,9 @@
|
||||||
(defn- take-snapshot?
|
(defn- take-snapshot?
|
||||||
"Defines the rule when file `data` snapshot should be saved."
|
"Defines the rule when file `data` snapshot should be saved."
|
||||||
[{:keys [revn modified-at] :as file}]
|
[{:keys [revn modified-at] :as file}]
|
||||||
(when (contains? cf/flags :file-snapshot)
|
(when (contains? cf/flags :auto-file-snapshot)
|
||||||
(let [freq (or (cf/get :file-snapshot-every) 20)
|
(let [freq (or (cf/get :auto-file-snapshot-every) 20)
|
||||||
timeout (or (cf/get :file-snapshot-timeout)
|
timeout (or (cf/get :auto-file-snapshot-timeout)
|
||||||
(dt/duration {:hours 1}))]
|
(dt/duration {:hours 1}))]
|
||||||
|
|
||||||
(or (= 1 freq)
|
(or (= 1 freq)
|
||||||
|
@ -420,7 +420,7 @@
|
||||||
(defn- delete-old-snapshots!
|
(defn- delete-old-snapshots!
|
||||||
[{:keys [::db/conn] :as cfg} {:keys [id] :as file}]
|
[{:keys [::db/conn] :as cfg} {:keys [id] :as file}]
|
||||||
(when-let [snapshots (not-empty (db/exec! conn [sql:get-latest-snapshots id
|
(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)
|
(let [last-date (-> snapshots peek :created-at)
|
||||||
result (db/exec-one! conn [sql:delete-snapshots id last-date])]
|
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)))))
|
(l/trc :hint "delete old snapshots" :file-id (str id) :total (db/get-update-count result)))))
|
||||||
|
|
Loading…
Add table
Reference in a new issue