feat(scanner): quiet scans, enqueue coalescing, watcher probe, sibling cache
Part 2 of the faceted plan, Phase 5 (steps 5-6): the scan that used to print ~4 lines per unchanged file now prints ONE summary line, and a poll tick landing mid-scan no longer stacks a second full scan. - Quiet scans (§4): the walk loop is silent — inserts, changes, and errors log inside processMediaFile; the duplicate 'Successfully processed' branch (both branches printed it) and the per-file 'processing / already exists / same size, skipping' chatter are gone. Summary carries the trigger and a changed counter: 'Scan of <folders> (trigger: poll): N files, N changed, N new, Xs, N errors'. Triggers threaded through every enqueue site: poll (startBackupScan), watcher (dirty-dirs flush), admin (scan API), initial (startup scan). - Enqueue coalescing (§5): Worker.HasActiveScanForLibrary (JobResult gains additive job_type so only SCAN jobs coalesce — an import sharing the library id never blocks one). enqueueLibraryScan skips silently; the admin scan API answers 409 with the active job id. Enforces the one-scan-per-library invariant the bulk scan-state map leans on. - Watcher capability probe (§4): ONE Add on a root folder; failure disables the watcher with a single startup line (replaces the per-directory warning spam on inotify-broken deployments). The watcher stays an optional latency reducer over scheduled scans. - Per-directory sibling cache (§6): hasSiblingBookFileCached caches the ReadDir per directory for one scan — loose-image manga re-stats thousands of images sharing a handful of directories. Tests: TestHasActiveScanForLibrary (unit — running/pending coalesce, terminal jobs don't, non-scan jobs don't, empty library never, nil worker safe). Full scanner suite green in the container.
This commit is contained in:
1 parent
6750e9e0dc
commit
5245f292ca
5 files changed
+225
-49
No files matched your search
@@ -219,3 +219,21 @@ cover_image_path, has_conflict, format_group, badge`.
|
||||
re-extraction (deploy-day rule). Multifile folder/zip books keep the
|
||||
Phase 3 behavior (their change path does not consume sidecar
|
||||
extractors yet — gating them would flip books "changed" for nothing).
|
||||
|
||||
## 2026-10-19 — Scanner Phase 5: quiet scans, coalescing, watcher probe
|
||||
|
||||
- `POST /api/scanner/scan` now answers **409** (with `active_job_id`)
|
||||
when a scan for the same library is already pending/running —
|
||||
coalescing instead of stacking a second full scan. The endpoint was
|
||||
never pinned; no existing response shape changed. Poll ticks and
|
||||
watcher events coalesce silently (no second job enqueued).
|
||||
- Scan jobs carry a `trigger` label (poll/watcher/admin/initial); the
|
||||
per-scan log is now ONE summary line:
|
||||
`Scan of <folders> (trigger: <t>): N files, N changed, N new, Xs, N errors`.
|
||||
Per-file "processing/success/skipping" chatter is gone; inserts,
|
||||
changes, and errors still log individually.
|
||||
- `JobResult` gains additive `job_type` (coalescing needs it; the
|
||||
scan-progress surfaces tolerate unknown keys).
|
||||
- Watcher: a failed capability probe (one `Add` on a root folder)
|
||||
disables the watcher with ONE startup line instead of per-directory
|
||||
warning spam.
|
||||
Reference in new issue
Block a user