fix(library): update real-time folder tree photo counts and persist scan state across page reloads
This commit is contained in:
@@ -46,7 +46,7 @@ const LANES = 4;
|
||||
// How often the walk's position is written down, in the same seconds as the
|
||||
// catalogue is read back on: the position is the whole of what the walk has found
|
||||
// and not read, and writing it is a string of a few megabytes on a long roll.
|
||||
const WALK_MS = 5000;
|
||||
const WALK_MS = 1000;
|
||||
// How often the screen is told how far the reading has come: the column is
|
||||
// rebuilt out of the count, and a rebuild a frame is a reading that spends its
|
||||
// time drawing itself. Five times a second is a counter that moves to the eye
|
||||
@@ -872,12 +872,8 @@ export async function scanFolder(
|
||||
// again is skipped on its size and its time.
|
||||
let wroteAt = 0;
|
||||
const write = async () => {
|
||||
// A reading kept to one folder has no position to write: the file it would
|
||||
// go in is the whole roll's, and a fraction of the tree written there is a
|
||||
// roll that comes back with the rest of itself missing.
|
||||
if (bounded) return;
|
||||
const at = Date.now();
|
||||
if (at - wroteAt < WALK_MS) return;
|
||||
if (wroteAt !== 0 && at - wroteAt < WALK_MS) return;
|
||||
wroteAt = at;
|
||||
const held = [...inHand, ...batch.map(pathOf)];
|
||||
const savedEntries = entries.slice(0, 500).map((e) => e.rel);
|
||||
@@ -1093,7 +1089,7 @@ export async function scanFolder(
|
||||
// walks the roll from the top and skips what has not moved. A reading kept to
|
||||
// one folder never wrote one down, and the file it would clear is the whole
|
||||
// roll's — a position another reading is in the middle of.
|
||||
if (!stop && !bounded) await clearWalk(folder.name);
|
||||
if (!stop) await clearWalk(folder.name);
|
||||
// The last word, whatever the clock says: the frames the reading got to are
|
||||
// the frames the column is about to be told about one last time.
|
||||
publish(true);
|
||||
|
||||
Reference in New Issue
Block a user