fix(downloads): enqueue thumbnail + ML per attached image #46

Merged
bvandeusen merged 1 commits from dev into main 2026-06-01 21:52:42 -04:00
Owner

Summary

Downloaded images stayed at thumbnail_path=NULL until a periodic
backfill sweep picked them up — gallery showed broken-thumbnail tiles
for hours after a download landed.

Importer.attach_in_place deliberately skips inline thumbnail
generation (importer.py:591-592) so the import queue stays moving;
the CALLING task is responsible. tasks/import_file.py:228-239
already does this. tasks/download.py / download_service did not.

Fix in download_service._phase3_persist: after each successful
attach_in_place, fan out generate_thumbnail.delay() +
tag_and_embed.delay() for each image_id. Lazy import to avoid
circular-import risk.

Test plan

  • CI green on bd06794
  • Operator confirms new downloads gain thumbnails without needing
    the periodic backfill sweep

🤖 Generated with Claude Code

## Summary Downloaded images stayed at `thumbnail_path=NULL` until a periodic backfill sweep picked them up — gallery showed broken-thumbnail tiles for hours after a download landed. `Importer.attach_in_place` deliberately skips inline thumbnail generation (importer.py:591-592) so the import queue stays moving; the CALLING task is responsible. `tasks/import_file.py:228-239` already does this. `tasks/download.py` / `download_service` did not. Fix in `download_service._phase3_persist`: after each successful `attach_in_place`, fan out `generate_thumbnail.delay()` + `tag_and_embed.delay()` for each `image_id`. Lazy import to avoid circular-import risk. ## Test plan - [x] CI green on `bd06794` - [ ] Operator confirms new downloads gain thumbnails without needing the periodic backfill sweep 🤖 Generated with [Claude Code](https://claude.com/claude-code)
bvandeusen added 1 commit 2026-06-01 21:52:36 -04:00
fix(downloads): enqueue thumbnail + ML tasks per attached image
CI / lint (push) Successful in 2s
CI / frontend-build (push) Successful in 18s
CI / backend-lint-and-test (push) Successful in 21s
CI / intimp (push) Successful in 3m43s
CI / intapi (push) Successful in 7m53s
CI / intcore (push) Successful in 8m23s
bd06794647
Operator-flagged 2026-06-01: downloaded images stayed at
thumbnail_path=NULL until a periodic backfill sweep picked them up,
surfacing as broken-thumbnail tiles in the gallery for hours after
the download landed.

Importer.attach_in_place deliberately skips inline thumbnail
generation (importer.py:591-592) so the import queue stays moving —
the CALLING task is responsible for the enqueue. tasks/import_file.py
already did this (line 228-239). tasks/download.py / download_service
did not — every gallery-dl-attached image landed un-thumbnailed.

Fix in download_service._phase3_persist: after each
`attach_in_place` returning status in (imported, superseded), fan out
`generate_thumbnail.delay()` + `tag_and_embed.delay()` for each
image_id. Lazy import avoids circular-import risk between
download_service and the celery task modules that depend on it.

Mirrors the existing pattern verbatim — single source of truth for
"what fires after a successful attach" remains a comment in two
places (filesystem-import task, download orchestrator) rather than
a shared helper, because the contexts differ enough (sync session vs
async orchestrator) that abstracting would obscure more than it'd
share.

Test covers the happy-path with two attached files: both get the
thumbnail enqueue AND the ML enqueue, with image_ids drawn from
ImportResult (so future supersede-on-attach paths stay covered).
bvandeusen merged commit 8e4d252ae4 into main 2026-06-01 21:52:42 -04:00
Sign in to join this conversation.
No Reviewers
No Label
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: bvandeusen/FabledCurator#46