Repository navigation
[codex] Expand provider image cache queue - #176
Conversation
|
No actionable comments were generated in the recent review. 🎉 ℹ️ Recent review info⚙️ Run configurationConfiguration used: Organization UI Review profile: CHILL Plan: Pro Plus Run ID: 📒 Files selected for processing (6)
🚧 Files skipped from review as they are similar to previous changes (3)
📝 WalkthroughWalkthroughIntroduces an asynchronous metadata image caching pipeline: a ChangesMetadata Image Cache Pipeline
Trigger Goroutine Closure Fix
Estimated code review effort🎯 4 (Complex) | ⏱️ ~75 minutes Possibly related PRs
🚥 Pre-merge checks | ✅ 4 | ❌ 1❌ Failed checks (1 warning)
✅ Passed checks (4 passed)
✏️ Tip: You can configure your own custom pre-merge checks in the settings. ✨ Finishing Touches📝 Generate docstrings
🧪 Generate unit tests (beta)
Comment |
There was a problem hiding this comment.
💡 Codex Review
Here are some automated review suggestions for this pull request.
Reviewed commit: c56542a090
ℹ️ About Codex in GitHub
Your team has set up Codex to review pull requests in this repo. Reviews are triggered when you
- Open a pull request for review
- Mark a draft as ready
- Comment "@codex review".
If Codex has suggestions, it will comment; otherwise it will react with 👍.
Codex can also answer questions or update the PR. Try commenting "@codex address that feedback".
| if metadataImageCacheProcessor != nil { | ||
| taskMgr.Register(tasks.NewCacheMetadataImagesTask(metadataImageCacheProcessor)) |
There was a problem hiding this comment.
Honor cache_images before scheduling automatic caching
When object storage is configured, this task is registered regardless of metadata.cache_images (which defaults to false). Its startup/interval executions call EnqueueExistingProviderArtwork, so merely configuring S3 causes the entire provider-artwork catalog to be downloaded and stored even when automatic image caching is disabled; the hot-reload flag only gates MetadataService enqueue sites and does not gate this task. Register or execute the processor conditionally on the setting, including configuration changes.
Useful? React with 👍 / 👎.
| locked_by = '', | ||
| last_error = '', | ||
| updated_at = NOW() | ||
| WHERE id = $1 |
There was a problem hiding this comment.
Guard terminal updates with the claimed job version
If metadata changes an artwork source while its old job is running, EnqueueBatch rewrites the same row with the new source and requeues it, but the old worker later reaches this unconditional update and marks that new job succeeded after its source-matching target update was skipped. The new artwork then remains uncached until the succeeded row is eventually deleted. Both success and failure transitions should verify the claimed source/lease token or worker before updating the row.
Useful? React with 👍 / 👎.
| } | ||
| stats.EnqueuedExisting = enqueued | ||
|
|
||
| jobs, err := p.jobs.ClaimDue(ctx, workerID, claimLimit) |
There was a problem hiding this comment.
Claim only work that fits inside the lease
The scheduled task passes a claim limit of 1,000 with concurrency 12, and this call leases every selected row before most of them can enter the semaphore. With the 30-second download timeout, jobs after roughly the first 360 can wait longer than the 15-minute lease before processing even starts; another worker calling recoverExpiredRunning can then reclaim them, causing duplicate downloads and competing terminal writes. Claim incrementally near the concurrency level or renew leases for jobs waiting in the local queue.
Useful? React with 👍 / 👎.
| func (p *ImageCacheProcessor) cleanupSucceeded(ctx context.Context, stats *ImageCacheRunStats) { | ||
| cleanupCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 10*time.Second) | ||
| defer cancel() | ||
| deleted, err := p.jobs.DeleteSucceededBefore(cleanupCtx, time.Now().Add(-30*24*time.Hour), 1000) |
There was a problem hiding this comment.
Retain deduplication state when pruning successes
Deleting succeeded rows here removes the only marker used by EnqueueExistingProviderArtwork to distinguish already-cached source paths. Because successful writeback deliberately retains each *_source_path, the next batch sees j.id IS NULL, recreates the job, and downloads/uploads the same image again; this repeats for the catalog every 30 days. Preserve a compact success marker or make discovery verify the cached destination before pruning.
Useful? React with 👍 / 👎.
| } | ||
| } | ||
|
|
||
| result, err := p.cacher.CacheImage(ctx, CacheImageRequest{ |
There was a problem hiding this comment.
Avoid uploading stale jobs to the live artwork key
A source-match check happens only after CacheImage has uploaded variants to the deterministic live key. If an admin applies another image while this job is in flight, the stale job can overwrite the newly selected object even though UpdateArtworkIfSourceMatches subsequently returns false; the database continues pointing at that key, so the stale image is displayed. Verify ownership before upload or write to versioned/source-specific keys and publish them only after the conditional update.
Useful? React with 👍 / 👎.
| if err := rows.Err(); err != nil { | ||
| return 0, fmt.Errorf("iterating existing provider artwork: %w", err) | ||
| } | ||
| return r.EnqueueBatch(ctx, inputs) |
There was a problem hiding this comment.
Release query rows before enqueueing the batch
rows retains its pgxpool connection until this function returns, but the return expression calls EnqueueBatch first and needs another connection. With a one-connection pool, or when every other connection is occupied, the cache task waits for a connection while holding the one that could satisfy the request; its runtime budget cannot interrupt this because the task context has no deadline. Close the rows after scanning and before calling EnqueueBatch.
Useful? React with 👍 / 👎.
| mi.tmdb_id, | ||
| mi.tvdb_id, | ||
| mi.imdb_id |
There was a problem hiding this comment.
Coalesce nullable IDs before scanning discovery rows
The media_items external-ID columns are nullable, but this query returns them directly and later scans all three into Go strings. When an artwork candidate has a NULL tmdb_id, tvdb_id, or imdb_id—which is valid for existing and legacy rows—pgx fails the scan, aborting EnqueueExistingProviderArtwork and therefore the entire scheduled cache run before any jobs are claimed. Select COALESCE(..., '') for these columns or scan nullable values.
Useful? React with 👍 / 👎.
| FROM media_items mi | ||
| WHERE mi.poster_source_path LIKE '%://%' | ||
| AND lower(mi.poster_source_path) NOT LIKE ALL (ARRAY['s3://%', 'file://%', 'local://%', 'upload://%', 'generated://%']) |
There was a problem hiding this comment.
Avoid rescanning the full catalog for every cache batch
EnqueueExistingProviderArtwork builds its candidates from multiple full-table branches using non-indexable LIKE '%://%' predicates, and RunUntilIdle invokes this query again for every 1,000-job batch. Large backlogs therefore repeatedly rescan and sort the entire item, localization, season, episode, and people catalogs during one run, while an idle installation still performs the same scans every minute. Discover work incrementally from indexed state or run the catalog sweep less frequently than queue draining.
Useful? React with 👍 / 👎.
There was a problem hiding this comment.
Actionable comments posted: 5
🧹 Nitpick comments (2)
internal/metadata/image_cache_enqueue_test.go (1)
91-99: ⚡ Quick winAssert the full queued job contract here.
This test would still pass if the jobs used the wrong
SourcePath,TargetType, orImageType. Add assertions for those fields so regressions in the processor payload are caught close to the enqueue path.Suggested test hardening
if enqueuer.inputs[0].TargetContentID != season.ContentID { t.Fatalf("season job target = %q, want %q", enqueuer.inputs[0].TargetContentID, season.ContentID) } + if enqueuer.inputs[0].TargetType != ImageCacheTargetSeason || + enqueuer.inputs[0].ImageType != ImageCacheImagePoster || + enqueuer.inputs[0].SourcePath != "tvdb://banners/seasons/1.jpg" { + t.Fatalf("season job = %#v", enqueuer.inputs[0]) + } if enqueuer.inputs[1].TargetContentID != episode.ContentID { t.Fatalf("episode job target = %q, want %q", enqueuer.inputs[1].TargetContentID, episode.ContentID) } + if enqueuer.inputs[1].TargetType != ImageCacheTargetEpisode || + enqueuer.inputs[1].ImageType != ImageCacheImageStill || + enqueuer.inputs[1].SourcePath != "tvdb://banners/episodes/1.jpg" { + t.Fatalf("episode job = %#v", enqueuer.inputs[1]) + }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/metadata/image_cache_enqueue_test.go` around lines 91 - 99, The test assertions in the enqueue validation block only verify the TargetContentID field for both jobs but do not validate the complete job contract. Add additional assertions for the SourcePath, TargetType, and ImageType fields for both enqueuer.inputs[0] (the season job) and enqueuer.inputs[1] (the episode job) to ensure regressions in the processor payload are caught at the enqueue path. Each field should be checked against the corresponding expected value from the season and episode objects to ensure the full job payload is correct.internal/manga/enrichment.go (1)
745-777: ⚡ Quick winBatch the full-enrichment image enqueue.
enqueueRemoteArtworkcurrently callsEnqueueBatchonce per image viaenqueueRemoteImage, so a result with poster, backdrop, and logo performs three queue upserts. Build the inputs and enqueue once.♻️ Proposed refactor
func (e *Enricher) enqueueRemoteArtwork(ctx context.Context, contentID string, result *metadata.MetadataResult) { - if e == nil || result == nil || contentID == "" { + if e == nil || e.imageCacheJobs == nil || result == nil || contentID == "" { return } - e.enqueueRemoteImage(ctx, contentID, result.PosterPath, metadata.ImagePoster) - e.enqueueRemoteImage(ctx, contentID, result.BackdropPath, metadata.ImageBackdrop) - e.enqueueRemoteImage(ctx, contentID, result.LogoPath, metadata.ImageLogo) + inputs := make([]metadata.EnqueueImageCacheJobInput, 0, 3) + add := func(sourcePath string, imageType metadata.ImageType) { + if !isRemoteHTTPImage(sourcePath) { + return + } + inputs = append(inputs, metadata.EnqueueImageCacheJobInput{ + TargetType: metadata.ImageCacheTargetItem, + TargetContentID: contentID, + SeriesID: contentID, + SourcePath: sourcePath, + ProviderID: mangaMetadataImageProviderID, + ProviderContentID: contentID, + ContentType: mangaContentType(), + ImageType: metadata.ImageTypeToString(imageType), + }) + } + add(result.PosterPath, metadata.ImagePoster) + add(result.BackdropPath, metadata.ImageBackdrop) + add(result.LogoPath, metadata.ImageLogo) + if len(inputs) == 0 { + return + } + + enqueueCtx, cancel := context.WithTimeout(context.WithoutCancel(ctx), 30*time.Second) + defer cancel() + if _, err := e.imageCacheJobs.EnqueueBatch(enqueueCtx, inputs); err != nil { + slog.Warn("manga enrichment: failed to enqueue image cache jobs", + "content_id", contentID, + "count", len(inputs), + "error", err, + ) + } }🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the rest with a brief reason, keep changes minimal, and validate. In `@internal/manga/enrichment.go` around lines 745 - 777, The enqueueRemoteArtwork function currently calls enqueueRemoteImage three separate times (for poster, backdrop, and logo paths), resulting in three separate EnqueueBatch calls and three database upserts. Refactor enqueueRemoteArtwork to build all the metadata.EnqueueImageCacheJobInput objects in a single slice within the function itself, then call e.imageCacheJobs.EnqueueBatch once with all inputs together. This consolidates the remote image enqueuing into a single batch operation instead of three separate ones, improving efficiency.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
Inline comments:
In `@internal/imagecache/imagecache.go`:
- Around line 281-298: The putObjectWithRetry function currently creates and
waits for a backoff timer even on the final attempt (attempt=2), unnecessarily
delaying the return of the permanent error. Modify the function to skip the
timer creation and delay on the last attempt by adding a condition to check if
this is the final iteration before creating the timer. When it is the final
attempt and PutObject fails, the function should immediately return the lastErr
without sleeping.
In `@internal/metadata/image_cache_job_repo.go`:
- Around line 153-225: The SQL update operations in the conflict resolution and
terminal job handlers lack guards against stale workers claiming old
source_paths and incorrectly marking newly queued replacement jobs as complete.
Add WHERE clause conditions in the `MarkSucceeded` and `MarkFailed` operations
to include verification of the claimed source_path and/or lease owner identity,
ensuring that only the worker who originally claimed a particular source can
mark it as terminal. Thread the claimed source_path and worker identifier
(locked_by value) through the processor interface and update the WHERE clauses
in these methods to match against these values in addition to the job id,
preventing a stale worker from mutating a row that has been repurposed with new
content.
In `@internal/metadata/image_cache_processor.go`:
- Around line 145-159: The issue is that jobs are claimed as running before it's
known whether they will actually be processed, so when a goroutine returns due
to context cancellation before acquiring the semaphore token, the claimed job
remains locked. Fix this by either acquiring the semaphore before spawning the
goroutine (move the semaphore acquisition logic outside the goroutine), or
explicitly handle the early return case in the context cancellation branch to
fail or requeue the claimed job. This ensures no jobs are left locked when
cancellation occurs before the semaphore token is obtained in the goroutine.
In `@internal/metadata/merge.go`:
- Around line 198-200: The `PhotoSourcePath` field is being merged independently
from `PhotoPath`, but it should be coupled to ensure they always represent the
same source image. Modify the merge logic so that `PhotoSourcePath` is only
updated when `PhotoPath` is accepted according to the merge mode. Instead of
calling mergeScalar separately for `PhotoSourcePath`, make its merge conditional
on whether `PhotoPath` was actually accepted, preventing the destination from
inheriting source provenance for a different photo. This same coupling should be
applied to the other related merge locations mentioned (around lines 365-370).
In `@migrations/sql/20260617184537_metadata_image_cache_queue.sql`:
- Around line 8-16: The UPDATE statements for the seasons table (updating
poster_source_path) and episodes table (updating still_source_path) are missing
the exclusion pattern that filters out S3 and special URL schemes. Add the
clause AND lower(poster_path) NOT LIKE ALL (ARRAY['s3://%', 'file://%',
'local://%', 'upload://%', 'generated://%']) to the WHERE condition of the
seasons UPDATE statement, and add AND lower(still_path) NOT LIKE ALL
(ARRAY['s3://%', 'file://%', 'local://%', 'upload://%', 'generated://%']) to the
WHERE condition of the episodes UPDATE statement to match the exclusion logic
used in other backfill migrations and ensure cached or system-generated artwork
is not recached.
---
Nitpick comments:
In `@internal/manga/enrichment.go`:
- Around line 745-777: The enqueueRemoteArtwork function currently calls
enqueueRemoteImage three separate times (for poster, backdrop, and logo paths),
resulting in three separate EnqueueBatch calls and three database upserts.
Refactor enqueueRemoteArtwork to build all the
metadata.EnqueueImageCacheJobInput objects in a single slice within the function
itself, then call e.imageCacheJobs.EnqueueBatch once with all inputs together.
This consolidates the remote image enqueuing into a single batch operation
instead of three separate ones, improving efficiency.
In `@internal/metadata/image_cache_enqueue_test.go`:
- Around line 91-99: The test assertions in the enqueue validation block only
verify the TargetContentID field for both jobs but do not validate the complete
job contract. Add additional assertions for the SourcePath, TargetType, and
ImageType fields for both enqueuer.inputs[0] (the season job) and
enqueuer.inputs[1] (the episode job) to ensure regressions in the processor
payload are caught at the enqueue path. Each field should be checked against the
corresponding expected value from the season and episode objects to ensure the
full job payload is correct.
🪄 Autofix (Beta)
Fix all unresolved CodeRabbit comments on this PR:
- Push a commit to this branch (recommended)
- Create a new PR with the fixes
ℹ️ Review info
⚙️ Run configuration
Configuration used: Organization UI
Review profile: CHILL
Plan: Pro Plus
Run ID: 933cc980-f44f-4e43-91cb-a26b1dabc29c
📒 Files selected for processing (36)
cmd/silo/main.gointernal/audiobooks/enrichment.gointernal/catalog/episode_catalog_source.gointernal/catalog/episode_repo.gointernal/catalog/item_repo.gointernal/catalog/localization_repo.gointernal/catalog/localize.gointernal/catalog/person_repo.gointernal/catalog/season_repo.gointernal/catalog/update.gointernal/ebooks/enrichment.gointernal/imagecache/imagecache.gointernal/imagecache/imagecache_test.gointernal/manga/enrichment.gointernal/metadata/fallback_unification_test.gointernal/metadata/image_cache_enqueue_test.gointernal/metadata/image_cache_job_repo.gointernal/metadata/image_cache_job_repo_test.gointernal/metadata/image_cache_processor.gointernal/metadata/image_cache_processor_test.gointernal/metadata/merge.gointernal/metadata/person_refresh.gointernal/metadata/plugin_provider.gointernal/metadata/service.gointernal/metadata/types.gointernal/models/media.gointernal/models/metadata_image_cache_job.gointernal/taskmanager/tasks/cache_metadata_images.gointernal/taskmanager/tasks/cache_metadata_images_test.gointernal/taskmanager/triggers/daily.gointernal/taskmanager/triggers/interval.gointernal/taskmanager/triggers/interval_test.gointernal/taskmanager/triggers/startup.gointernal/taskmanager/triggers/weekly.gomigrations/sql/20260617184537_metadata_image_cache_queue.sqlmigrations/sql/20260617203000_expand_metadata_image_cache_jobs.sql
| mergeScalar(&target.PhotoPath, source.PhotoPath, mode) | ||
| mergeScalar(&target.PhotoSourcePath, source.PhotoSourcePath, mode) | ||
| mergeScalar(&target.PhotoThumbhash, source.PhotoThumbhash, mode) |
There was a problem hiding this comment.
Keep PhotoSourcePath coupled to the photo path it describes.
PhotoSourcePath is merged even when PhotoPath is not accepted, so a destination with an existing photo can inherit provenance for a different source image. That can make the async cache worker update/cache the wrong photo source.
Suggested fix
- mergeScalar(&target.PhotoPath, source.PhotoPath, mode)
- mergeScalar(&target.PhotoSourcePath, source.PhotoSourcePath, mode)
+ beforePhotoPath := target.PhotoPath
+ mergeScalar(&target.PhotoPath, source.PhotoPath, mode)
+ if target.PhotoPath == source.PhotoPath || beforePhotoPath == source.PhotoPath {
+ mergeScalar(&target.PhotoSourcePath, source.PhotoSourcePath, mode)
+ }
mergeScalar(&target.PhotoThumbhash, source.PhotoThumbhash, mode) if dst.PhotoPath == "" {
dst.PhotoPath = src.PhotoPath
+ dst.PhotoSourcePath = src.PhotoSourcePath
}
- if dst.PhotoSourcePath == "" {
+ if dst.PhotoSourcePath == "" && dst.PhotoPath == src.PhotoPath {
dst.PhotoSourcePath = src.PhotoSourcePath
}Also applies to: 365-370
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.
In `@internal/metadata/merge.go` around lines 198 - 200, The `PhotoSourcePath`
field is being merged independently from `PhotoPath`, but it should be coupled
to ensure they always represent the same source image. Modify the merge logic so
that `PhotoSourcePath` is only updated when `PhotoPath` is accepted according to
the merge mode. Instead of calling mergeScalar separately for `PhotoSourcePath`,
make its merge conditional on whether `PhotoPath` was actually accepted,
preventing the destination from inheriting source provenance for a different
photo. This same coupling should be applied to the other related merge locations
mentioned (around lines 365-370).
Code reviewNo issues found. Checked for bugs and CLAUDE.md compliance. 🤖 Generated with Claude Code - If this code review was useful, please react with 👍. Otherwise, react with 👎. |
Addresses bug-review feedback from Codex/CodeRabbit on the metadata image cache pipeline. All findings validated against the code before fixing; false positives (rows/connection deadlock, PhotoSourcePath merge coupling) were confirmed non-issues and left unchanged. - Honor metadata.cache_images for the background processor. The cache_metadata_images task was registered whenever S3 was configured, so merely enabling object storage downloaded the entire provider-artwork catalog even with caching disabled. Add ImageCacheProcessor.SetEnabled, gate RunOnce/RunUntilIdle on it, and wire it (with hot reload) from cfg.Metadata.CacheImages in main.go. - Guard terminal job updates with lease ownership. EnqueueBatch can repurpose a running row with a new source; MarkSucceeded/MarkFailed keyed on id alone let a stale worker finalize the replacement job and drop the new artwork. Thread locked_by through and add status='running' AND locked_by=$n guards. - Avoid uploading stale jobs onto the live artwork key. Verify the target still references the job's source (CurrentTargetSourcePath) before CacheImage, so a job whose source an admin/refresh already replaced cannot overwrite the deterministic storage object. - COALESCE nullable external IDs in EnqueueExistingProviderArtwork. A NULL tmdb_id/tvdb_id/imdb_id on any candidate failed the scan and aborted the whole cache run; matches the existing item_repo pattern. - Stop re-downloading the catalog every 30 days. Discovery now skips targets whose *_path is already a cached relative path, making the cached row the durable dedup marker instead of the prunable job row. - Decouple catalog sweeps from queue draining. RunOnce no longer runs discovery per batch; RunUntilIdle sweeps only when the queue drains and throttles full sweeps to every 15m, so idle installs stop full-scanning every entity table each minute. - Requeue claimed-but-unstarted jobs on cancellation. Acquire the semaphore before spawning workers and RequeueClaimed any jobs not yet started, instead of leaving them locked until the 15m lease expires. - Skip the backoff sleep after the final upload attempt in putObjectWithRetry (saves ~1.5s on permanent failures). - Add the s3/file/local/upload/generated exclusion to the seasons and episodes backfill in migration 20260617184537 for consistency with the later migration (the bad backfill was inert downstream, but the asymmetry is removed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <[email protected]>
* feat(metadata): expand provider image cache queue * fix(metadata): harden provider image cache queue Addresses bug-review feedback from Codex/CodeRabbit on the metadata image cache pipeline. All findings validated against the code before fixing; false positives (rows/connection deadlock, PhotoSourcePath merge coupling) were confirmed non-issues and left unchanged. - Honor metadata.cache_images for the background processor. The cache_metadata_images task was registered whenever S3 was configured, so merely enabling object storage downloaded the entire provider-artwork catalog even with caching disabled. Add ImageCacheProcessor.SetEnabled, gate RunOnce/RunUntilIdle on it, and wire it (with hot reload) from cfg.Metadata.CacheImages in main.go. - Guard terminal job updates with lease ownership. EnqueueBatch can repurpose a running row with a new source; MarkSucceeded/MarkFailed keyed on id alone let a stale worker finalize the replacement job and drop the new artwork. Thread locked_by through and add status='running' AND locked_by=$n guards. - Avoid uploading stale jobs onto the live artwork key. Verify the target still references the job's source (CurrentTargetSourcePath) before CacheImage, so a job whose source an admin/refresh already replaced cannot overwrite the deterministic storage object. - COALESCE nullable external IDs in EnqueueExistingProviderArtwork. A NULL tmdb_id/tvdb_id/imdb_id on any candidate failed the scan and aborted the whole cache run; matches the existing item_repo pattern. - Stop re-downloading the catalog every 30 days. Discovery now skips targets whose *_path is already a cached relative path, making the cached row the durable dedup marker instead of the prunable job row. - Decouple catalog sweeps from queue draining. RunOnce no longer runs discovery per batch; RunUntilIdle sweeps only when the queue drains and throttles full sweeps to every 15m, so idle installs stop full-scanning every entity table each minute. - Requeue claimed-but-unstarted jobs on cancellation. Acquire the semaphore before spawning workers and RequeueClaimed any jobs not yet started, instead of leaving them locked until the 15m lease expires. - Skip the backoff sleep after the final upload attempt in putObjectWithRetry (saves ~1.5s on permanent failures). - Add the s3/file/local/upload/generated exclusion to the seasons and episodes backfill in migration 20260617184537 for consistency with the later migration (the bad backfill was inert downstream, but the asymmetry is removed). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude Opus 4.8 <[email protected]> --------- Co-authored-by: Claude Opus 4.8 <[email protected]>
Summary
profileimage support, conditional writebacks, retry/backoff handling, and startup/interval task processing.Root Cause
Episode and season artwork cache work was being performed inline during metadata refreshes and later queue discovery still scanned already-succeeded rows first. Large catalogs could spend cache runs repeatedly re-reading already-cached episode rows, which delayed or prevented later image types from being reached.
Validation
GOWORK=off go test ./internal/metadata ./internal/imagecache ./internal/catalog ./internal/audiobooks ./internal/ebooks ./internal/manga ./internal/taskmanager/tasks ./cmd/silo ./migrationsgit diff --checkmake dev-deployand verified live DB state.Live validation after deploy:
6,172to25.168to5.577to83.2.357succeeded,221running, and queued backlog continuing to drain.tmdb/people/.../profile/original.webpwhile retainingphoto_source_path = tmdb://profile/....Full
GOWORK=off go test ./...was also run; unrelated environment-sensitive failures remain ininternal/jellycompatprocess-lock tests andinternal/playbackNVENC probe tests.Impact
Scans and metadata refreshes no longer block on large remote image downloads/uploads. Provider images are cached asynchronously with durable retries, while manual/generated/local/S3 artwork is excluded from recaching.
AI Use
Implemented with AI assistance in Codex.
Summary by CodeRabbit