mirror of
https://github.com/storytold/effectcraft.git
synced 2026-10-30 04:57:54 -06:00
Settings ▸ Import ▸ Reload Footage Changed on Disk used to spawn a stat thread every two seconds from the UI thread, request a repaint 100 ms later to collect it, and request another repaint every 2 s in between, for every project with items, focused or not: the whole interface redrew on a timer for footage that hadn't changed. `footage_reload::Watcher` is one long-lived worker: the interface tells it what to watch (recomputed when the project revision or the preference changes) and whether the window is in front; it stamps the files every 2 s while the window is in front, every 10 s while another app has the front, at once on focus regain and on a new set, and hands the stamps over — calling `ctx.request_repaint()` — only when one differs from its last look. Nothing watched means the thread sleeps. `apply_stamps` and the reload semantics are unchanged; `start_scan`/`poll_scan`/`Session::footage_scan` are gone. No new dependencies: the stat loop is also what footage on a network share relies on, where FSEvents would not report another machine's writes. Tests: the watcher wakes the interface for the first stamps and for each change and never for an unchanged file; behind another app it rests until the window is back; nothing watched is nothing stamped and a new set is reported whole (and dropping it ends the thread); the host test `the_watcher_notices_a_footage_file_changed_on_disk` saves a PSD from "another app" and sees it reloaded once. Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>