1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2025-01-14 14:43:17 +08:00

Merge pull request #396 from desertwitch/master

fix #346 RangeError running jobs on large DBs
This commit is contained in:
Patrik J. Braun 2021-12-11 16:05:43 +01:00 committed by GitHub
commit 97c10ce9af
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -102,12 +102,16 @@ export abstract class FileJob<S extends { indexedOnly: boolean } = { indexedOnly
this.directoryQueue.push(path.join(item.path, item.name));
}
if (this.scanFilter.noPhoto !== true || this.scanFilter.noVideo !== true) {
this.fileQueue.push(...(await this.filterMediaFiles(scanned.media))
.map(f => path.join(ProjectPath.ImageFolder, f.directory.path, f.directory.name, f.name)));
const scannedAndFiltered = await this.filterMediaFiles(scanned.media);
for (const item of scannedAndFiltered) {
this.fileQueue.push(path.join(ProjectPath.ImageFolder, item.directory.path, item.directory.name, item.name));
}
}
if (this.scanFilter.noMetaFile !== true) {
this.fileQueue.push(...(await this.filterMetaFiles(scanned.metaFile))
.map(f => path.join(ProjectPath.ImageFolder, f.directory.path, f.directory.name, f.name)));
const scannedAndFiltered = await this.filterMetaFiles(scanned.metaFile);
for (const item of scannedAndFiltered) {
this.fileQueue.push(path.join(ProjectPath.ImageFolder, item.directory.path, item.directory.name, item.name));
}
}
}
@ -136,7 +140,8 @@ export abstract class FileJob<S extends { indexedOnly: boolean } = { indexedOnly
.leftJoinAndSelect('media.directory', 'directory')
.getMany();
this.fileQueue.push(...(result
.map(f => path.join(ProjectPath.ImageFolder, f.directory.path, f.directory.name, f.name))));
for (const item of result) {
this.fileQueue.push(path.join(ProjectPath.ImageFolder, item.directory.path, item.directory.name, item.name));
}
}
}