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:
parent
ad645feb43
commit
3ef2746bc2
@ -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);
|
||||||
|
@ -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;
|
||||||
}
|
}
|
||||||
@ -349,9 +348,9 @@ export class GalleryManager implements IGalleryManager, ISQLGalleryManager {
|
|||||||
}
|
}
|
||||||
await fileRepository.save(metaFilesToSave);
|
await fileRepository.save(metaFilesToSave);
|
||||||
await fileRepository.remove(indexedMetaFiles);
|
await fileRepository.remove(indexedMetaFiles);
|
||||||
}catch (e){
|
} catch (e) {
|
||||||
throw e;
|
throw e;
|
||||||
}finally {
|
} finally {
|
||||||
this.isSaving = false;
|
this.isSaving = false;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -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'
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
|
@ -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 {
|
||||||
|
@ -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;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user