mirror of
https://github.com/vladmandic/automatic
synced 2026-09-19 09:14:35 +02:00
[hotfix] Fix cache clearing when switching folders (#4421)
* Update submodules
* Revert "Update submodules"
This reverts commit 1679ddeeea.
* Fix cache clearing when switching folders
This is more of a temporary hotfix since it will affect switching between gallery folders quickly and it'll kick off when viewing small folders.
This commit is contained in:
@@ -7,6 +7,7 @@ let outstanding = 0;
|
||||
let lastSort = 0;
|
||||
let lastSortName = 'None';
|
||||
let idbIsCleaning = false;
|
||||
let activeGalleryFolder = '';
|
||||
const galleryHashes = new Set();
|
||||
// Store separator states for the session
|
||||
const separatorStates = new Map();
|
||||
@@ -592,10 +593,10 @@ async function thumbCacheCleanup() {
|
||||
}
|
||||
|
||||
const removeOverlayFunc = showCleaningMsg();
|
||||
idbClean(galleryHashes)
|
||||
.then((delcount) => {
|
||||
idbClean(galleryHashes, activeGalleryFolder)
|
||||
.then((delcount, folder) => {
|
||||
const t1 = performance.now();
|
||||
log(`Thumbnail DB cleanup: kept=${galleryHashes.size} deleted=${delcount} time=${Math.floor(t1 - t0)}ms`);
|
||||
log(`Thumbnail DB cleanup: folder=${folder} kept=${galleryHashes.size} deleted=${delcount} time=${Math.floor(t1 - t0)}ms`);
|
||||
})
|
||||
.catch((err) => {
|
||||
error('Thumbnail DB cleanup: Cleanup failed.', err.message);
|
||||
@@ -632,6 +633,7 @@ async function fetchFilesHT(evt) {
|
||||
el.files.appendChild(fragment);
|
||||
|
||||
const t1 = performance.now();
|
||||
activeGalleryFolder = evt.target.name;
|
||||
log(`gallery: folder=${evt.target.name} num=${numFiles} time=${Math.floor(t1 - t0)}ms`);
|
||||
updateStatusWithSort(`Folder: ${evt.target.name} | ${numFiles.toLocaleString()} images | ${Math.floor(t1 - t0).toLocaleString()}ms`);
|
||||
addSeparators();
|
||||
@@ -686,6 +688,7 @@ async function fetchFilesWS(evt) { // fetch file-by-file list over websockets
|
||||
ws.onclose = (event) => {
|
||||
el.files.appendChild(fragment);
|
||||
// gallerySort();
|
||||
activeGalleryFolder = evt.target.name;
|
||||
log(`gallery: folder=${evt.target.name} num=${numFiles} time=${Math.floor(t1 - t0)}ms`);
|
||||
updateStatusWithSort(`Folder: ${evt.target.name} | ${numFiles.toLocaleString()} images | ${Math.floor(t1 - t0).toLocaleString()}ms`);
|
||||
addSeparators();
|
||||
|
||||
Reference in New Issue
Block a user