♻️ Name the temp-file boot clean for what it does

`app.jobs.utils/init` initialized nothing: its only work was the
boot-time sweep of temp files a crashed process left behind. It is
now the public `clean-orphans`, with a docstring that says it runs
once at boot, and `app.core` calls it by that name.

AI-assisted-by: muse-spark-1.3-contributor
This commit is contained in:
Andrey Antukh 2026-10-07 17:34:44 +00:00
parent b1cd524f9b
commit 71a96351c4
2 changed files with 4 additions and 7 deletions

View File

@ -40,7 +40,7 @@
:image-cache-size (cf/get :wasm-worker-image-cache-size))
(p/do
(bwr/init)
(job.utils/init)
(job.utils/clean-orphans)
(wasm.pool/init)
(worker/start)))))

View File

@ -53,9 +53,10 @@
nil)))
(p/resolved nil))))
(defn- clean
(defn clean-orphans
"Removes managed temp files older than the job TTL. They can only be leftovers
of a previous process: every live one belongs to a job of this process."
of a previous process: every live one belongs to a job of this process.
Runs once at boot; nothing here needs initializing."
[]
(let [max-age (* 1000 (cf/get :exporter-job-ttl 3600))
now (js/Date.now)]
@ -80,7 +81,3 @@
(p/merr (fn [cause]
(l/warn :hint "temp file cleanup failed" :cause cause)
(p/resolved 0))))))
(defn init
[]
(clean))