fix(ingest): repair the winter clock on desktop previews too #254
No files matched your search
@@ -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
|
||||
|
||||
@@ -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. */
|
||||
|
||||
Reference in new issue
Block a user