[PR #3970] [MERGED] fix(server): regenerate missing person thumbnails #10187

Closed
opened 2026-02-05 14:17:24 +03:00 by OVERLORD · 0 comments
Owner

📋 Pull Request Information

Original PR: https://github.com/immich-app/immich/pull/3970
Author: @daniele-athome
Created: 9/4/2023
Status: Merged
Merged: 9/8/2023
Merged by: @alextran1502

Base: mainHead: fix/people-thumbnails-final


📝 Commits (10+)

📊 Changes

13 files changed (+183 additions, -13 deletions)

View changed files

📝 server/src/domain/facial-recognition/facial-recognition.service.spec.ts (+1 -0)
📝 server/src/domain/facial-recognition/facial-recognition.services.ts (+1 -1)
📝 server/src/domain/job/job.constants.ts (+2 -2)
📝 server/src/domain/media/media.service.spec.ts (+73 -1)
📝 server/src/domain/media/media.service.ts (+29 -0)
📝 server/src/domain/person/person.repository.ts (+4 -1)
📝 server/src/domain/person/person.service.spec.ts (+15 -6)
📝 server/src/domain/person/person.service.ts (+1 -1)
📝 server/src/infra/entities/person.entity.ts (+7 -0)
server/src/infra/migrations/1693833336881-AddPersonFaceAssetId.ts (+15 -0)
📝 server/src/infra/repositories/person.repository.ts (+13 -1)
📝 server/test/fixtures/person.stub.ts (+19 -0)
📝 server/test/repositories/person.repository.mock.ts (+3 -0)

📄 Description

Fix #3741.

  • Queue face thumbnail generation for person records with empty thumbnailPath (the "forced" version will queue jobs for all people)
  • ⚠️ Architectural change ⚠️ Move face thumbnail generation from face recognition queue to thumbnail generation queue
  • Renamed IPersonRepository.getAll to IPersonRepository.getAllForUser since I needed getAll for this PR (very opinionated, I would need guidance from the Immich team to address this change properly)
  • Store the assetId used for extracting a person's face in person.faceAssetId (it will be reused when regenerating the person's thumbnail, otherwise a random asset will be used)

I moved the job to the thumbnail generation queue because it seemed more appropriate - also given where it's started from. Although the actual job implementation is still inside the facial recognition module.

Next steps would be checking if the thumbnail file is missing and force regeneration (for another PR maybe).

Tests

  • automated tests
  • regenerate missing face thumbnails
  • regenerate all face thumbnails
  • no side effects of empty thumbnail path in explore page (no people showed)
  • no side effects of empty thumbnail path in people page (no people showed)
  • no side effects of empty thumbnail path in person page (blank missing avatar showed)
  • other possible side effects of empty thumbnail path?

🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.

## 📋 Pull Request Information **Original PR:** https://github.com/immich-app/immich/pull/3970 **Author:** [@daniele-athome](https://github.com/daniele-athome) **Created:** 9/4/2023 **Status:** ✅ Merged **Merged:** 9/8/2023 **Merged by:** [@alextran1502](https://github.com/alextran1502) **Base:** `main` ← **Head:** `fix/people-thumbnails-final` --- ### 📝 Commits (10+) - [`ecb228d`](https://github.com/immich-app/immich/commit/ecb228d0dd407c82939637578bcffbdf8dd8e172) Regenerate missing person thumbnails - [`7d1dc6f`](https://github.com/immich-app/immich/commit/7d1dc6f72402050fb4986c7ad8ec26742f1854e5) Check for empty string instead of zero length - [`fa22a44`](https://github.com/immich-app/immich/commit/fa22a4413c2b8a36967c1988ef1fce00387fb623) Remember asset used as person face - [`fb29b17`](https://github.com/immich-app/immich/commit/fb29b17a178d177ab4f56e012dc96a427f9426d1) Define entity relation between person and asset via faceAssetId - [`52ec4ca`](https://github.com/immich-app/immich/commit/52ec4cab7aad155a1d7d591c8a5e6aca93f09a33) Typo - [`a417def`](https://github.com/immich-app/immich/commit/a417def721365d0ef6fc65c78f182858c3c72449) Fix entity relation - [`f313ff9`](https://github.com/immich-app/immich/commit/f313ff9508dfcc7ba61a56ca5a4ff81bd89fc494) Tests - [`e43428f`](https://github.com/immich-app/immich/commit/e43428f29b62d3fb6809166a78feebd291783bd3) Tests - [`1b2012c`](https://github.com/immich-app/immich/commit/1b2012cf333b88c5e0a7fe18e9918911bc068342) Fix code formatting - [`96f539b`](https://github.com/immich-app/immich/commit/96f539bc697cf33da70daffbd052968e6e139a1d) Fix import path ### 📊 Changes **13 files changed** (+183 additions, -13 deletions) <details> <summary>View changed files</summary> 📝 `server/src/domain/facial-recognition/facial-recognition.service.spec.ts` (+1 -0) 📝 `server/src/domain/facial-recognition/facial-recognition.services.ts` (+1 -1) 📝 `server/src/domain/job/job.constants.ts` (+2 -2) 📝 `server/src/domain/media/media.service.spec.ts` (+73 -1) 📝 `server/src/domain/media/media.service.ts` (+29 -0) 📝 `server/src/domain/person/person.repository.ts` (+4 -1) 📝 `server/src/domain/person/person.service.spec.ts` (+15 -6) 📝 `server/src/domain/person/person.service.ts` (+1 -1) 📝 `server/src/infra/entities/person.entity.ts` (+7 -0) ➕ `server/src/infra/migrations/1693833336881-AddPersonFaceAssetId.ts` (+15 -0) 📝 `server/src/infra/repositories/person.repository.ts` (+13 -1) 📝 `server/test/fixtures/person.stub.ts` (+19 -0) 📝 `server/test/repositories/person.repository.mock.ts` (+3 -0) </details> ### 📄 Description Fix #3741. * Queue face thumbnail generation for person records with empty thumbnailPath (the "forced" version will queue jobs for all people) * :warning: **Architectural change** :warning: Move face thumbnail generation from face recognition queue to thumbnail generation queue * Renamed `IPersonRepository.getAll` to `IPersonRepository.getAllForUser` since I needed `getAll` for this PR (very opinionated, I would need guidance from the Immich team to address this change properly) * Store the assetId used for extracting a person's face in `person.faceAssetId` (it will be reused when regenerating the person's thumbnail, otherwise a random asset will be used) I moved the job to the thumbnail generation queue because it seemed more appropriate - also given where it's started from. Although the actual job implementation is still inside the facial recognition module. Next steps would be checking if the thumbnail file is missing and force regeneration (for another PR maybe). ### Tests - [x] automated tests - [x] regenerate missing face thumbnails - [x] regenerate all face thumbnails - [x] no side effects of empty thumbnail path in explore page (no people showed) - [x] no side effects of empty thumbnail path in people page (no people showed) - [x] no side effects of empty thumbnail path in person page (blank missing avatar showed) - [x] other possible side effects of empty thumbnail path? --- <sub>🔄 This issue represents a GitHub Pull Request. It cannot be merged through Gitea due to API limitations.</sub>
OVERLORD added the pull-request label 2026-02-05 14:17:24 +03:00
Sign in to join this conversation.
1 Participants
Notifications
Due Date
No due date set.
Dependencies

No dependencies set.

Reference: immich-app/immich#10187