fix: missing files integrity checks (#29737)

This commit is contained in:
Daniel Dietzler 2026-07-08 21:53:46 +02:00 committed by GitHub
parent 053a52aec8
commit 66e30d5fa1
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
4 changed files with 5 additions and 5 deletions

View file

@ -86,7 +86,7 @@ select
from
"asset_file"
-- IntegrityRepository.streamAssetPaths
-- IntegrityRepository.streamAssetPathsForMissingFiles
select
"allPaths"."path" as "path",
"allPaths"."assetId",

View file

@ -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')),

View file

@ -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)) {

View file

@ -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,
});