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

improving not modified results

This commit is contained in:
Patrik J. Braun 2018-12-09 12:02:02 +01:00
parent ad645feb43
commit 3ef2746bc2
5 changed files with 14 additions and 10 deletions

View File

@ -14,6 +14,7 @@ import {RandomQuery} from '../model/interfaces/IGalleryManager';
import {MediaDTO} from '../../common/entities/MediaDTO';
import {VideoDTO} from '../../common/entities/VideoDTO';
import {Utils} from '../../common/Utils';
import {QueryParams} from '../../common/QueryParams';
const LOG_TAG = '[GalleryMWs]';
@ -32,7 +33,9 @@ export class GalleryMWs {
try {
const directory = await ObjectManagerRepository.getInstance()
.GalleryManager.listDirectory(directoryName, req.query.knownLastModified, req.query.knownLastScanned);
.GalleryManager.listDirectory(directoryName,
parseInt(req.query[QueryParams.gallery.knownLastModified], 10),
parseInt(req.query[QueryParams.gallery.knownLastScanned], 10));
if (directory == null) {
req.resultPipe = new ContentWrapper(null, null, true);

View File

@ -94,11 +94,10 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
if (knownLastModified && knownLastScanned
&& lastModified === knownLastModified &&
dir.lastScanned === knownLastScanned) {
if (Config.Server.indexing.reIndexingSensitivity === ReIndexingSensitivity.low) {
return null;
}
if (Date.now() - knownLastScanned <= Config.Server.indexing.cachedFolderTimeout &&
if (Date.now() - dir.lastScanned <= Config.Server.indexing.cachedFolderTimeout &&
Config.Server.indexing.reIndexingSensitivity === ReIndexingSensitivity.medium) {
return null;
}

View File

@ -11,6 +11,8 @@ export const QueryParams = {
},
photo: 'p',
sharingKey_short: 'sk',
sharingKey_long: 'sharingKey'
sharingKey_long: 'sharingKey',
knownLastModified: 'knownLastModified',
knownLastScanned: 'knownLastScanned'
}
};

View File

@ -66,8 +66,8 @@ export class GalleryService {
if (content.directory && content.directory.lastModified && content.directory.lastScanned &&
!content.directory.isPartial) {
params['knownLastModified'] = content.directory.lastModified;
params['knownLastScanned'] = content.directory.lastScanned;
params[QueryParams.gallery.knownLastModified] = content.directory.lastModified;
params[QueryParams.gallery.knownLastScanned] = content.directory.lastScanned;
}
try {

View File

@ -46,8 +46,8 @@ export class QueryService {
}
if (directory && directory.lastModified && directory.lastScanned &&
!directory.isPartial) {
params['knownLastModified'] = directory.lastModified;
params['knownLastScanned'] = directory.lastScanned;
params[QueryParams.gallery.knownLastModified] = directory.lastModified;
params[QueryParams.gallery.knownLastScanned] = directory.lastScanned;
}
return params;