From a30b04ae34e1875b0fc58f00dd307db562b8c050 Mon Sep 17 00:00:00 2001 From: spark Date: Sat, 7 Nov 2026 16:15:45 +0000 Subject: [PATCH] fix(ingest): repair the winter clock on desktop previews too The live photos stay on the photographer's computer. The preview the server kept still has the camera clock, so the hour repair has to read that file. --- apps/api/src/ingest/service.ts | 11 +++++------ apps/api/src/worker.ts | 4 ++-- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/apps/api/src/ingest/service.ts b/apps/api/src/ingest/service.ts index b839751..8a15d98 100644 --- a/apps/api/src/ingest/service.ts +++ b/apps/api/src/ingest/service.ts @@ -497,19 +497,18 @@ export class IngestService { } /** - * Photos stored an hour early because the camera still writes +01:00 in winter. Re-read the file with the - * current clock rules and, when it moves by that hour, put the capture time right and let the autopilot - * decide the frame again. + * Photos stored an hour early because the camera still writes +01:00 in winter. Re-read the stored file + * (the original, or the preview the desktop sent, which keeps the camera's clock) and, when it moves by + * that hour, put the capture time right and let the autopilot decide the frame again. */ - async backfillCaptureClock(limit = 40): Promise { + async backfillCaptureClock(limit = 100): Promise { const { db, storage, log } = this.deps; const rows = await db.$queryRaw< Array<{ id: string; storage_key: string; captured_at: Date | null; taken_at: Date; autopilot: unknown; exif: unknown }> >` SELECT id, storage_key, captured_at, taken_at, autopilot, exif FROM photos - WHERE original_stored - AND status = 'READY' + WHERE status = 'READY' AND created_at > now() - interval '3 days' AND ( exif IS NULL diff --git a/apps/api/src/worker.ts b/apps/api/src/worker.ts index 63d04bf..b1915a5 100644 --- a/apps/api/src/worker.ts +++ b/apps/api/src/worker.ts @@ -186,10 +186,10 @@ invoices.start(); // Photos that arrived before on-camera stars were read: apply Rating from the original in storage. const ratingBackfill = setInterval(() => { void ingest.backfillCameraRatings(25).catch((err) => log.warn({ err }, "ingest: camera rating backfill failed")); - void ingest.backfillCaptureClock(40).catch((err) => log.warn({ err }, "ingest: capture clock repair failed")); + void ingest.backfillCaptureClock(100).catch((err) => log.warn({ err }, "ingest: capture clock repair failed")); }, 60_000); void ingest.backfillCameraRatings(25).catch((err) => log.warn({ err }, "ingest: camera rating backfill failed")); -void ingest.backfillCaptureClock(40).catch((err) => log.warn({ err }, "ingest: capture clock repair failed")); +void ingest.backfillCaptureClock(100).catch((err) => log.warn({ err }, "ingest: capture clock repair failed")); log.info({ ingestRoot: config.INGEST_ROOT, storage: config.STORAGE_ROOT }, "worker started"); /** Drain in-flight jobs before ending the Prisma/pg pool (BIT-31189). Leave headroom under PM2 kill_timeout. */ -- 2.47.3