mirror of
https://github.com/penpot/penpot.git
synced 2025-02-25 08:16:49 -05:00
🐛 Fix file-xlog-gc task.
And decrease the execution interval of the task to every 2 hours.
This commit is contained in:
parent
5c1290d5b3
commit
1b70283c3a
2 changed files with 5 additions and 6 deletions
|
@ -165,7 +165,7 @@
|
||||||
:fn (ig/ref :app.tasks.file-media-gc/handler)}
|
:fn (ig/ref :app.tasks.file-media-gc/handler)}
|
||||||
|
|
||||||
{:id "file-xlog-gc"
|
{:id "file-xlog-gc"
|
||||||
:cron #app/cron "0 0 0 */1 * ?" ;; daily
|
:cron #app/cron "0 0 */2 * * ?" ;; every 2 hours
|
||||||
:fn (ig/ref :app.tasks.file-xlog-gc/handler)}
|
:fn (ig/ref :app.tasks.file-xlog-gc/handler)}
|
||||||
|
|
||||||
{:id "storage-gc"
|
{:id "storage-gc"
|
||||||
|
@ -229,7 +229,7 @@
|
||||||
|
|
||||||
:app.tasks.file-xlog-gc/handler
|
:app.tasks.file-xlog-gc/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)
|
||||||
:max-age (dt/duration {:hours 12})
|
:max-age (dt/duration {:hours 6})
|
||||||
:metrics (ig/ref :app.metrics/metrics)}
|
:metrics (ig/ref :app.metrics/metrics)}
|
||||||
|
|
||||||
:app.tasks.telemetry/handler
|
:app.tasks.telemetry/handler
|
||||||
|
@ -275,7 +275,6 @@
|
||||||
:handler (ig/ref :app.telemetry/handler)
|
:handler (ig/ref :app.telemetry/handler)
|
||||||
:name "telemetry"}})))
|
:name "telemetry"}})))
|
||||||
|
|
||||||
|
|
||||||
(defmethod ig/init-key :default [_ data] data)
|
(defmethod ig/init-key :default [_ data] data)
|
||||||
(defmethod ig/prep-key :default [_ data] (d/without-nils data))
|
(defmethod ig/prep-key :default [_ data] (d/without-nils data))
|
||||||
|
|
||||||
|
|
|
@ -36,8 +36,8 @@
|
||||||
|
|
||||||
(def ^:private
|
(def ^:private
|
||||||
sql:delete-files-xlog
|
sql:delete-files-xlog
|
||||||
"delete from task_completed
|
"delete from file_change
|
||||||
where scheduled_at < now() - ?::interval")
|
where created_at < now() - ?::interval")
|
||||||
|
|
||||||
(defn- handler
|
(defn- handler
|
||||||
[{:keys [pool max-age]} _]
|
[{:keys [pool max-age]} _]
|
||||||
|
@ -45,5 +45,5 @@
|
||||||
(let [interval (db/interval max-age)
|
(let [interval (db/interval max-age)
|
||||||
result (db/exec-one! conn [sql:delete-files-xlog interval])
|
result (db/exec-one! conn [sql:delete-files-xlog interval])
|
||||||
result (:next.jdbc/update-count result)]
|
result (:next.jdbc/update-count result)]
|
||||||
(log/infof "removed %s rows from file_changes table" result)
|
(log/infof "removed %s rows from file_change table" result)
|
||||||
nil)))
|
nil)))
|
||||||
|
|
Loading…
Add table
Reference in a new issue