Commit Graph
2 Commits
Author SHA1 Message Date
Nathaniel LedfordandClaude Opus 5.5 6234a0c917 LRC-LIB-MISSING: the availability worker sweeps a list of files at low priority and gives way to file work
The availability worker that answers "is this file there?" for the grid and the
Info panel can now also check a long list of files (every library photo's file,
for the sidebar's Missing Photos count), without that list getting in the way:

- Availability::sweep takes a list, checked one file at a time and only when
  nothing is asked; files checked less than 15 s ago are skipped, and one sweep
  runs at a time. The files found gone are kept (is_gone, gone_len), and
  gone_generation, which replaces generation, changes only when a file is found
  gone or back: a file found there at its first check changes nothing the
  Missing Photos view shows, and wakes nobody.
- Availability::restart_sweeps / sweep_in drop what is left of a sweep when
  another library is opened, and refuse a list that was being made for the old
  one.
- Availability::sweep_yields_to takes a callback; while it says file work is
  going on (an import, a scan, a folder listing), the worker starts no sweep
  check. What is asked is still answered at once, and the sweep goes on where it
  stopped, so a share is not asked for a stat of every file while a scan reads
  it: 32 readers got 101 files/s alone and 65 files/s with one stat loop beside
  them.

Nothing in the app starts a sweep yet; the worker tests exercise it.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-21 21:48:09 -04:00
Brandon ThomasandClaude Opus 5.5 7b59081d22 Issue #104: keep file-system calls off the UI thread
Re-applies fix/issue-104-ui-fs on top of the data-safety fixes (integrate/safety):
- availability cache: originals and smart previews are checked on a worker thread; the UI
  answers from the cache (grid, Info panel, photo menu, Missing Photos view)
- import split into ImportJob::prepare (worker) + commit_prepared, with Cancel; Copy keeps
  #96's verified copies
- Find Missing Photos: find_candidates (snapshot, no I/O) + plan_find_missing (all file I/O,
  on a worker, never the session) with #105's matching rules unchanged (name+size+hash;
  renamed by size+hash; single name+size; ambiguous look-alikes skipped and reported; files
  already in use excluded). The plan is applied with library.findMissing {found, missing,
  ambiguous}, re-checked against the catalog then: photos relinked meanwhile are left alone,
  files now in use are not taken. library.findMissing {folder} still runs synchronously.
- Build / Discard Smart Previews with background: true runs on a worker with progress and
  Stop, keeping #106's atomic writes, is_valid checks and `repaired` count (also in
  library.previewProgress); the render worker's smart-preview fallback uses is_valid
- Rename preview planned on a worker (plan_rename_photos) on the same planning core as
  Session::plan_rename_with (MoveFs, case-only respelling by file identity, #95)
- Local folder listing via fs_cached; tests_offline (slow injected probe, frames < 300 ms)

Tests: worker-planned Find Missing equals the synchronous command for a renamed + ambiguous
library; a plan is re-checked when applied; background smart previews repair a damaged proxy.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-10-05 18:58:04 -04:00