1
0
mirror of https://github.com/xuthus83/pigallery2.git synced 2024-11-03 21:04:03 +08:00

Adding never indexing severity to only index if explicitly asked. fixes #613

This commit is contained in:
Patrik J. Braun 2023-09-02 16:06:23 +02:00
parent b8ed84b7ae
commit 440daba68c
3 changed files with 24 additions and 10 deletions

View File

@ -40,16 +40,26 @@ export class GalleryManager {
const directoryPath = GalleryManager.parseRelativeDirePath(
relativeDirectoryName
);
const connection = await SQLConnection.getConnection();
const stat = fs.statSync(
path.join(ProjectPath.ImageFolder, relativeDirectoryName)
);
const lastModified = DiskMangerWorker.calcLastModified(stat);
const dir = await this.getDirIdAndTime(connection, directoryPath.name, directoryPath.parent);
if (dir && dir.lastScanned != null) {
// Return as soon as possible without touching the original data source (hdd)
// See https://github.com/bpatrik/pigallery2/issues/613
if (
Config.Indexing.reIndexingSensitivity ===
ReIndexingSensitivity.never
) {
return null;
}
const stat = fs.statSync(
path.join(ProjectPath.ImageFolder, relativeDirectoryName)
);
const lastModified = DiskMangerWorker.calcLastModified(stat);
// If it seems that the content did not change, do not work on it
if (
knownLastModified &&

View File

@ -64,9 +64,12 @@ export enum SQLLogLevel {
}
export enum ReIndexingSensitivity {
low = 1,
medium = 2,
high = 3,
// Order is important. It also used to do relative comparison.
// Keep space between items for future
never = 10,
low = 20,
medium = 30,
high = 40,
}
export enum FFmpegPresets {
@ -443,7 +446,7 @@ export class ServerIndexingConfig {
name: $localize`Folder reindexing sensitivity`,
priority: ConfigPriority.advanced
},
description: $localize`Set the reindexing sensitivity. High value check the folders for change more often.`
description: $localize`Set the reindexing sensitivity. High value check the folders for change more often. Setting to never only indexes if never indexed or explicit running the Indexing Job.`
})
reIndexingSensitivity: ReIndexingSensitivity = ReIndexingSensitivity.low;
@ConfigProperty({

View File

@ -39,6 +39,7 @@ EnumTranslations[MapProviders[MapProviders.OpenStreetMap]] = $localize`OpenStree
EnumTranslations[MapProviders[MapProviders.Mapbox]] = $localize`Mapbox`;
EnumTranslations[ReIndexingSensitivity[ReIndexingSensitivity.never]] = $localize`never`;
EnumTranslations[ReIndexingSensitivity[ReIndexingSensitivity.low]] = $localize`low`;
EnumTranslations[ReIndexingSensitivity[ReIndexingSensitivity.high]] = $localize`high`;
EnumTranslations[ReIndexingSensitivity[ReIndexingSensitivity.medium]] = $localize`medium`;