fix(ingest): repair the winter clock on desktop previews too (#254)
ci / rust (push) Successful in 9m14s
ci / typescript (push) Successful in 14m16s

fix(ingest): repair the winter clock on desktop previews too (#254)
This commit was merged in pull request #254.
This commit is contained in:
spark committed 2026-11-07 16:16:13 +00:00
1 parent 0d5689fb46
commit 28836c3a83
2 files changed
+7 -8

No files matched your search

+5 -6
View File
@@ -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<number> {
async backfillCaptureClock(limit = 100): Promise<number> {
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
+2 -2
View File
@@ -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. */