From d24c64e0a0a95c49a309877aad1603a710441f35 Mon Sep 17 00:00:00 2001 From: Claudio Date: Mon, 11 May 2026 12:08:31 +0200 Subject: [PATCH] fix(scan): stop auto-queuing backfill_gps on every startup MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit `_scan_all_source_roots_async` unconditionally dispatched backfill_gps 30s after each container boot. backfill_gps then queued one extract_metadata task for every photo where latitude IS NULL — which is most of the library (screenshots, indoor shots, scans, anything without GPS in EXIF). The result was ~60k extract_metadata tasks piling onto the default queue at every deploy, pinning worker-light at 180+% CPU for ~30 min while it re-derived metadata that wasn't going to change. The "scanned-before-the-GPS-fix" rationale in the original comment hasn't applied for many releases. Manual trigger via POST /api/v1/library/backfill-gps is preserved for the rare case where the extractor really did change. --- backend/app/tasks/scan.py | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/backend/app/tasks/scan.py b/backend/app/tasks/scan.py index e7b974c..55507e8 100644 --- a/backend/app/tasks/scan.py +++ b/backend/app/tasks/scan.py @@ -461,13 +461,16 @@ async def _scan_all_source_roots_async(): except Exception as e: logger.warning(f"Could not queue post-scan vision backfill: {e}") - # Re-extract metadata for photos missing GPS coordinates. - # Runs on every startup so photos scanned before the GPS fix - # eventually get their coordinates populated. - try: - backfill_gps.apply_async(countdown=30) - except Exception as e: - logger.warning(f"Could not queue post-scan GPS backfill: {e}") + # NOTE: we used to auto-queue `backfill_gps` here so photos + # scanned before the GPS-extraction fix would eventually get + # their coordinates populated. That fix shipped a long time + # ago, so on every modern restart it just re-ran + # extract_metadata for every photo that legitimately has no + # GPS in EXIF (screenshots, indoor shots, scans) — tens of + # thousands of pointless tasks that saturated worker-light + # for ~30 min after each deploy. Trigger manually via + # POST /api/v1/library/backfill-gps if you ever need it + # again (e.g. another extractor-logic fix lands). WATCHER_LOCK_KEY = "mulita:watch_folders:lock"