From 1b68ee093edf4d3a9b8a3d4296d10caa64b7dd2b Mon Sep 17 00:00:00 2001 From: Edouard Vanbelle Date: Fri, 28 Aug 2026 00:03:54 +0200 Subject: [PATCH] feat(storage): both import jobs tick daily instead of manual-only MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Registered with interval None, so they ran only when someone remembered to trigger them — which was your objection to gating anything on operator timing. Now daily. Not boot-time: that would delay readiness for a filesystem walk, and both jobs are idempotent and resumable, so periodic is strictly better. The tick deliberately does NOT delete. `repair` defaults false, so scheduled runs import and stop; unlinking stays a deliberate operator action, per no-silent-auto-repair. That splits the two halves the way their risk differs — the backfill is safe to automate, removing files is not. Cost once drained is a read_dir over three directories returning nothing, and after the directory itself is removed, not even that. --- .../services/thumb_attached_import_service.rs | 9 ++++++++- .../services/thumb_derived_import_service.rs | 16 +++++++++++++++- 2 files changed, 23 insertions(+), 2 deletions(-) diff --git a/src/infrastructure/services/thumb_attached_import_service.rs b/src/infrastructure/services/thumb_attached_import_service.rs index e6304329..2f13ec43 100644 --- a/src/infrastructure/services/thumb_attached_import_service.rs +++ b/src/infrastructure/services/thumb_attached_import_service.rs @@ -89,8 +89,15 @@ impl ThumbAttachedImport { registry: &JobRegistry, provider: &Arc, ) -> Arc { + // Daily, matching `thumb_derived_import` — and it does not delete on + // the tick either, since `repair` defaults false. See that job for + // the reasoning. registry - .register_recoverable_job(self.clone(), provider.clone(), None) + .register_recoverable_job( + self.clone(), + provider.clone(), + Some(std::time::Duration::from_secs(24 * 3600)), + ) .await; self } diff --git a/src/infrastructure/services/thumb_derived_import_service.rs b/src/infrastructure/services/thumb_derived_import_service.rs index 7bef4064..dcf0aa55 100644 --- a/src/infrastructure/services/thumb_derived_import_service.rs +++ b/src/infrastructure/services/thumb_derived_import_service.rs @@ -70,8 +70,22 @@ impl ThumbDerivedImport { registry: &JobRegistry, provider: &Arc, ) -> Arc { + // Daily tick rather than manual-only. Ops cannot be relied on to + // remember a migration, and boot-time would delay readiness for a + // filesystem walk — whereas this is idempotent and resumable, so + // periodic is safe and it drains on its own. + // + // The tick does NOT delete: `repair` defaults false, so scheduled + // runs import and stop. Deletion stays a deliberate operator action, + // per no-silent-auto-repair. Once drained, a run is a `read_dir` over + // three directories that returns nothing — and after the directory is + // removed, not even that. registry - .register_recoverable_job(self.clone(), provider.clone(), None) + .register_recoverable_job( + self.clone(), + provider.clone(), + Some(std::time::Duration::from_secs(24 * 3600)), + ) .await; self }