From 71a96351c4e3116fa781d5332040b1c8d1c31669 Mon Sep 17 00:00:00 2001 From: Andrey Antukh Date: Wed, 7 Oct 2026 17:34:44 +0000 Subject: [PATCH] :recycle: 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 --- exporter/src/app/core.cljs | 2 +- exporter/src/app/jobs/utils.cljs | 9 +++------ 2 files changed, 4 insertions(+), 7 deletions(-) diff --git a/exporter/src/app/core.cljs b/exporter/src/app/core.cljs index 2eb5471c87..25977ded0c 100644 --- a/exporter/src/app/core.cljs +++ b/exporter/src/app/core.cljs @@ -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))))) diff --git a/exporter/src/app/jobs/utils.cljs b/exporter/src/app/jobs/utils.cljs index 61963b71b0..158cbda0ea 100644 --- a/exporter/src/app/jobs/utils.cljs +++ b/exporter/src/app/jobs/utils.cljs @@ -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))