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 {MediaDTO} from '../../common/entities/MediaDTO';
import {VideoDTO} from '../../common/entities/VideoDTO'; import {VideoDTO} from '../../common/entities/VideoDTO';
import {Utils} from '../../common/Utils'; import {Utils} from '../../common/Utils';
import {QueryParams} from '../../common/QueryParams';
const LOG_TAG = '[GalleryMWs]'; const LOG_TAG = '[GalleryMWs]';
@ -32,7 +33,9 @@ export class GalleryMWs {
try { try {
const directory = await ObjectManagerRepository.getInstance() 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) { if (directory == null) {
req.resultPipe = new ContentWrapper(null, null, true); req.resultPipe = new ContentWrapper(null, null, true);

View File

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

View File

@ -11,6 +11,8 @@ export const QueryParams = {
}, },
photo: 'p', photo: 'p',
sharingKey_short: 'sk', 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 && if (content.directory && content.directory.lastModified && content.directory.lastScanned &&
!content.directory.isPartial) { !content.directory.isPartial) {
params['knownLastModified'] = content.directory.lastModified; params[QueryParams.gallery.knownLastModified] = content.directory.lastModified;
params['knownLastScanned'] = content.directory.lastScanned; params[QueryParams.gallery.knownLastScanned] = content.directory.lastScanned;
} }
try { try {

View File

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