mirror of
https://github.com/immich-app/immich
synced 2026-08-15 13:03:57 +00:00
fix: missing files integrity checks (#29737)
This commit is contained in:
parent
053a52aec8
commit
66e30d5fa1
4 changed files with 5 additions and 5 deletions
|
|
@ -86,7 +86,7 @@ select
|
|||
from
|
||||
"asset_file"
|
||||
|
||||
-- IntegrityRepository.streamAssetPaths
|
||||
-- IntegrityRepository.streamAssetPathsForMissingFiles
|
||||
select
|
||||
"allPaths"."path" as "path",
|
||||
"allPaths"."assetId",
|
||||
|
|
|
|||
|
|
@ -119,7 +119,7 @@ export class IntegrityRepository {
|
|||
}
|
||||
|
||||
@GenerateSql({ params: [], stream: true })
|
||||
streamAssetPaths() {
|
||||
streamAssetPathsForMissingFiles() {
|
||||
return this.db
|
||||
.selectFrom((eb) =>
|
||||
eb
|
||||
|
|
@ -143,7 +143,7 @@ export class IntegrityRepository {
|
|||
)
|
||||
.leftJoin('integrity_report', (join) =>
|
||||
join
|
||||
.on('integrity_report.type', '=', IntegrityReport.UntrackedFile)
|
||||
.on('integrity_report.type', '=', IntegrityReport.MissingFile)
|
||||
.on((eb) =>
|
||||
eb.or([
|
||||
eb('integrity_report.assetId', '=', eb.ref('allPaths.assetId')),
|
||||
|
|
|
|||
|
|
@ -360,7 +360,7 @@ export class IntegrityService extends BaseService {
|
|||
|
||||
this.logger.log(`Scanning for missing files...`);
|
||||
|
||||
const assetPaths = this.integrityRepository.streamAssetPaths();
|
||||
const assetPaths = this.integrityRepository.streamAssetPathsForMissingFiles();
|
||||
|
||||
let total = 0;
|
||||
for await (const batchPaths of chunk(assetPaths, JOBS_LIBRARY_PAGINATION_SIZE)) {
|
||||
|
|
|
|||
|
|
@ -408,7 +408,7 @@ describe(IntegrityService.name, () => {
|
|||
} = await ctx.newAsset({ ownerId, originalPath: '/path/to/file2' });
|
||||
|
||||
const { id: reportId } = await ctx.get(IntegrityRepository).create({
|
||||
type: IntegrityReport.UntrackedFile,
|
||||
type: IntegrityReport.MissingFile,
|
||||
path: '/path/to/file2',
|
||||
assetId: assetId2,
|
||||
});
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue