♻️ Normalize internal naming on the worker module

This commit is contained in:
Andrey Antukh 2022-11-22 14:51:26 +01:00
parent 10bf6c5e56
commit 13a092b192
5 changed files with 59 additions and 84 deletions

View file

@ -24,9 +24,8 @@
(defonce queue (a/chan 128))
(s/def ::min-age ::dt/duration)
(defmethod ig/pre-init-spec ::cleaner [_]
(s/keys :req-un [::min-age ::wrk/scheduler ::wrk/executor]))
(s/keys :req-un [::min-age ::wrk/scheduled-executor ::wrk/executor]))
(defmethod ig/prep-key ::cleaner
[_ cfg]
@ -34,7 +33,7 @@
(d/without-nils cfg)))
(defmethod ig/init-key ::cleaner
[_ {:keys [scheduler executor min-age] :as cfg}]
[_ {:keys [scheduled-executor executor min-age] :as cfg}]
(l/info :hint "starting tempfile cleaner service")
(let [cch (a/chan)]
(a/go-loop []
@ -42,7 +41,7 @@
(when (not= port cch)
(l/trace :hint "schedule tempfile deletion" :path path
:expires-at (dt/plus (dt/now) min-age))
(px/schedule! scheduler
(px/schedule! scheduled-executor
(inst-ms min-age)
(partial remove-temp-file executor path))
(recur))))