mirror of
https://github.com/penpot/penpot.git
synced 2025-01-26 00:19:07 -05:00
Merge remote-tracking branch 'origin/main' into develop
This commit is contained in:
commit
d7eec3b92b
4 changed files with 13 additions and 28 deletions
|
@ -230,30 +230,21 @@
|
||||||
|
|
||||||
:app.tasks.tasks-gc/handler
|
:app.tasks.tasks-gc/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)
|
||||||
:max-age cf/deletion-delay
|
:max-age cf/deletion-delay}
|
||||||
:metrics (ig/ref :app.metrics/metrics)}
|
|
||||||
|
|
||||||
:app.tasks.delete-object/handler
|
:app.tasks.delete-object/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)
|
||||||
:metrics (ig/ref :app.metrics/metrics)}
|
:storage (ig/ref :app.storage/storage)}
|
||||||
|
|
||||||
:app.tasks.delete-storage-object/handler
|
|
||||||
{:pool (ig/ref :app.db/pool)
|
|
||||||
:storage (ig/ref :app.storage/storage)
|
|
||||||
:metrics (ig/ref :app.metrics/metrics)}
|
|
||||||
|
|
||||||
:app.tasks.delete-profile/handler
|
:app.tasks.delete-profile/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)}
|
||||||
:metrics (ig/ref :app.metrics/metrics)}
|
|
||||||
|
|
||||||
:app.tasks.file-media-gc/handler
|
:app.tasks.file-media-gc/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)
|
||||||
:metrics (ig/ref :app.metrics/metrics)
|
|
||||||
:max-age cf/deletion-delay}
|
:max-age cf/deletion-delay}
|
||||||
|
|
||||||
:app.tasks.file-xlog-gc/handler
|
:app.tasks.file-xlog-gc/handler
|
||||||
{:pool (ig/ref :app.db/pool)
|
{:pool (ig/ref :app.db/pool)
|
||||||
:metrics (ig/ref :app.metrics/metrics)
|
|
||||||
:max-age (dt/duration {:hours 48})}
|
:max-age (dt/duration {:hours 48})}
|
||||||
|
|
||||||
:app.tasks.telemetry/handler
|
:app.tasks.telemetry/handler
|
||||||
|
|
|
@ -18,7 +18,7 @@
|
||||||
(declare handle-deletion)
|
(declare handle-deletion)
|
||||||
|
|
||||||
(defmethod ig/pre-init-spec ::handler [_]
|
(defmethod ig/pre-init-spec ::handler [_]
|
||||||
(s/keys :req-un [::db/pool]))
|
(s/keys :req-un [::db/pool ::sto/storage]))
|
||||||
|
|
||||||
(defmethod ig/init-key ::handler
|
(defmethod ig/init-key ::handler
|
||||||
[_ {:keys [pool] :as cfg}]
|
[_ {:keys [pool] :as cfg}]
|
||||||
|
|
|
@ -23,12 +23,12 @@
|
||||||
|
|
||||||
(defmethod ig/init-key ::handler
|
(defmethod ig/init-key ::handler
|
||||||
[_ {:keys [pool max-age] :as cfg}]
|
[_ {:keys [pool max-age] :as cfg}]
|
||||||
(fn [_]
|
(fn [task]
|
||||||
(db/with-atomic [conn pool]
|
(db/with-atomic [conn pool]
|
||||||
(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)]
|
||||||
(l/debug :action "trim file-change table" :removed result)
|
(l/debug :removed result :hint "remove old file changes")
|
||||||
result))))
|
result))))
|
||||||
|
|
||||||
(def ^:private
|
(def ^:private
|
||||||
|
|
|
@ -98,11 +98,11 @@
|
||||||
;; Terminate the loop if close channel is closed or
|
;; Terminate the loop if close channel is closed or
|
||||||
;; event-loop-fn returns nil.
|
;; event-loop-fn returns nil.
|
||||||
(or (= port close-ch) (nil? val))
|
(or (= port close-ch) (nil? val))
|
||||||
(l/debug :msg "stop condition found")
|
(l/debug :hint "stop condition found")
|
||||||
|
|
||||||
(db/pool-closed? pool)
|
(db/pool-closed? pool)
|
||||||
(do
|
(do
|
||||||
(l/debug :msg "eventloop aborted because pool is closed")
|
(l/debug :hint "eventloop aborted because pool is closed")
|
||||||
(a/close! close-ch))
|
(a/close! close-ch))
|
||||||
|
|
||||||
(and (instance? java.sql.SQLException val)
|
(and (instance? java.sql.SQLException val)
|
||||||
|
@ -115,7 +115,7 @@
|
||||||
(and (instance? java.sql.SQLException val)
|
(and (instance? java.sql.SQLException val)
|
||||||
(= "40001" (.getSQLState ^java.sql.SQLException val)))
|
(= "40001" (.getSQLState ^java.sql.SQLException val)))
|
||||||
(do
|
(do
|
||||||
(l/debug :msg "serialization failure (retrying in some instants)")
|
(l/debug :hint "serialization failure (retrying in some instants)")
|
||||||
(a/<! (a/timeout poll-ms))
|
(a/<! (a/timeout poll-ms))
|
||||||
(recur))
|
(recur))
|
||||||
|
|
||||||
|
@ -243,7 +243,7 @@
|
||||||
(let [task-fn (get tasks name)]
|
(let [task-fn (get tasks name)]
|
||||||
(if task-fn
|
(if task-fn
|
||||||
(task-fn item)
|
(task-fn item)
|
||||||
(l/warn :msg "no task handler found"
|
(l/warn :hint "no task handler found"
|
||||||
:name (d/name name)))
|
:name (d/name name)))
|
||||||
{:status :completed :task item}))
|
{:status :completed :task item}))
|
||||||
|
|
||||||
|
@ -281,19 +281,13 @@
|
||||||
[{:keys [tasks]} item]
|
[{:keys [tasks]} item]
|
||||||
(let [name (d/name (:name item))]
|
(let [name (d/name (:name item))]
|
||||||
(try
|
(try
|
||||||
(l/debug :action "start task"
|
(l/debug :action "execute task"
|
||||||
:name name
|
|
||||||
:id (:id item)
|
:id (:id item)
|
||||||
|
:name name
|
||||||
:retry (:retry-num item))
|
:retry (:retry-num item))
|
||||||
|
|
||||||
(handle-task tasks item)
|
(handle-task tasks item)
|
||||||
(catch Exception e
|
(catch Exception e
|
||||||
(handle-exception e item))
|
(handle-exception e item)))))
|
||||||
(finally
|
|
||||||
(l/debug :action "end task"
|
|
||||||
:name name
|
|
||||||
:id (:id item)
|
|
||||||
:retry (:retry-num item))))))
|
|
||||||
|
|
||||||
(def sql:select-next-tasks
|
(def sql:select-next-tasks
|
||||||
"select * from task as t
|
"select * from task as t
|
||||||
|
|
Loading…
Add table
Reference in a new issue