mirror of
https://github.com/immich-app/immich.git
synced 2025-06-04 22:24:26 -04:00
fix(server): person thumbnail generation always being queued (#15734)
* fix person thumbnail generation always being queued * fix thumbhash comparison * fix mock
This commit is contained in:
parent
64d926581f
commit
92412ca2f7
@ -495,7 +495,6 @@ export class AssetRepository implements IAssetRepository {
|
|||||||
.$if(property === WithoutProperty.THUMBNAIL, (qb) =>
|
.$if(property === WithoutProperty.THUMBNAIL, (qb) =>
|
||||||
qb
|
qb
|
||||||
.innerJoin('asset_job_status as job_status', 'assetId', 'assets.id')
|
.innerJoin('asset_job_status as job_status', 'assetId', 'assets.id')
|
||||||
.select(withFiles)
|
|
||||||
.where('assets.isVisible', '=', true)
|
.where('assets.isVisible', '=', true)
|
||||||
.where((eb) =>
|
.where((eb) =>
|
||||||
eb.or([
|
eb.or([
|
||||||
|
@ -100,7 +100,6 @@ export class PersonRepository implements IPersonRepository {
|
|||||||
.$if(!!options.personId, (qb) => qb.where('asset_faces.personId', '=', options.personId!))
|
.$if(!!options.personId, (qb) => qb.where('asset_faces.personId', '=', options.personId!))
|
||||||
.$if(!!options.sourceType, (qb) => qb.where('asset_faces.sourceType', '=', options.sourceType!))
|
.$if(!!options.sourceType, (qb) => qb.where('asset_faces.sourceType', '=', options.sourceType!))
|
||||||
.$if(!!options.assetId, (qb) => qb.where('asset_faces.assetId', '=', options.assetId!))
|
.$if(!!options.assetId, (qb) => qb.where('asset_faces.assetId', '=', options.assetId!))
|
||||||
.$if(!!options.assetId, (qb) => qb.where('asset_faces.assetId', '=', options.assetId!))
|
|
||||||
.stream() as AsyncIterableIterator<AssetFaceEntity>;
|
.stream() as AsyncIterableIterator<AssetFaceEntity>;
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -109,7 +108,7 @@ export class PersonRepository implements IPersonRepository {
|
|||||||
.selectFrom('person')
|
.selectFrom('person')
|
||||||
.selectAll('person')
|
.selectAll('person')
|
||||||
.$if(!!options.ownerId, (qb) => qb.where('person.ownerId', '=', options.ownerId!))
|
.$if(!!options.ownerId, (qb) => qb.where('person.ownerId', '=', options.ownerId!))
|
||||||
.$if(!!options.thumbnailPath, (qb) => qb.where('person.thumbnailPath', '=', options.thumbnailPath!))
|
.$if(options.thumbnailPath !== undefined, (qb) => qb.where('person.thumbnailPath', '=', options.thumbnailPath!))
|
||||||
.$if(options.faceAssetId === null, (qb) => qb.where('person.faceAssetId', 'is', null))
|
.$if(options.faceAssetId === null, (qb) => qb.where('person.faceAssetId', 'is', null))
|
||||||
.$if(!!options.faceAssetId, (qb) => qb.where('person.faceAssetId', '=', options.faceAssetId!))
|
.$if(!!options.faceAssetId, (qb) => qb.where('person.faceAssetId', '=', options.faceAssetId!))
|
||||||
.$if(options.isHidden !== undefined, (qb) => qb.where('person.isHidden', '=', options.isHidden!))
|
.$if(options.isHidden !== undefined, (qb) => qb.where('person.isHidden', '=', options.isHidden!))
|
||||||
|
@ -194,7 +194,7 @@ export class MediaService extends BaseService {
|
|||||||
await Promise.all(pathsToDelete.map((path) => this.storageRepository.unlink(path)));
|
await Promise.all(pathsToDelete.map((path) => this.storageRepository.unlink(path)));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (asset.thumbhash != generated.thumbhash) {
|
if (!asset.thumbhash || Buffer.compare(asset.thumbhash, generated.thumbhash) !== 0) {
|
||||||
await this.assetRepository.update({ id: asset.id, thumbhash: generated.thumbhash });
|
await this.assetRepository.update({ id: asset.id, thumbhash: generated.thumbhash });
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,7 +4,7 @@ import { Mocked, vitest } from 'vitest';
|
|||||||
export const newMediaRepositoryMock = (): Mocked<IMediaRepository> => {
|
export const newMediaRepositoryMock = (): Mocked<IMediaRepository> => {
|
||||||
return {
|
return {
|
||||||
generateThumbnail: vitest.fn().mockImplementation(() => Promise.resolve()),
|
generateThumbnail: vitest.fn().mockImplementation(() => Promise.resolve()),
|
||||||
generateThumbhash: vitest.fn().mockImplementation(() => Promise.resolve()),
|
generateThumbhash: vitest.fn().mockResolvedValue(Buffer.from('')),
|
||||||
decodeImage: vitest.fn().mockResolvedValue({ data: Buffer.from(''), info: {} }),
|
decodeImage: vitest.fn().mockResolvedValue({ data: Buffer.from(''), info: {} }),
|
||||||
extract: vitest.fn().mockResolvedValue(false),
|
extract: vitest.fn().mockResolvedValue(false),
|
||||||
probe: vitest.fn(),
|
probe: vitest.fn(),
|
||||||
|
Loading…
x
Reference in New Issue
Block a user