Skip to content

feat: live filesystem resync via SIGUSR1 signal#1206

Merged
perber merged 3 commits into
mainfrom
worktree-feat+fs-resync-signal
Jun 26, 2026
Merged

feat: live filesystem resync via SIGUSR1 signal#1206
perber merged 3 commits into
mainfrom
worktree-feat+fs-resync-signal

Conversation

@perber

@perber perber commented Jun 26, 2026

Copy link
Copy Markdown
Owner

Exposes the existing startup-time reconstruction logic as a runtime trigger so external tools can reload changed Markdown files without a container restart.

Send SIGUSR1 to the process to trigger a full reload:
kill -USR1

ReloadFromFS runs synchronously: tree reconstruction, link re-index, tag/property re-index and search re-index all complete before the signal handler processes the next queued signal. This avoids concurrent goroutines racing on IndexingStatus and the SQLite search index.

What is reloaded: page tree, link index, tag/property indexes, full-text search index.
What is NOT reloaded: assets (served from disk directly), auth/users (SQLite-based), revisions (no re-baseline).

Closes #1161

perber added 2 commits June 26, 2026 15:05
Exposes the existing startup-time reconstruction logic as a runtime
trigger so external tools can reload changed Markdown files without a
container restart.

Send SIGUSR1 to the process to trigger a full reload:
  kill -USR1 <pid>

ReloadFromFS runs synchronously: tree reconstruction, link re-index,
tag/property re-index and search re-index all complete before the
signal handler processes the next queued signal. This avoids concurrent
goroutines racing on IndexingStatus and the SQLite search index.

What is reloaded: page tree, link index, tag/property indexes,
full-text search index.
What is NOT reloaded: assets (served from disk directly), auth/users
(SQLite-based), revisions (no re-baseline).

Closes #1161
ReconstructTreeFromFS previously held the write lock for the entire FS
scan, blocking all tree reads (navigation, page rendering) for its
duration. Since the scan is the slow part and the swap is instant,
do the scan lock-free and acquire the write lock only for the in-memory
swap and index rebuild.

At startup (LoadTree) the lock is still held throughout — no traffic
is being served there, so it doesn't matter.
@perber
perber force-pushed the worktree-feat+fs-resync-signal branch from a85039a to 3bab202 Compare June 26, 2026 13:06
Adds POST /api/admin/resync endpoint (admin-only) and a
Maintenance settings page with a "Sync now" button visible
only to admins. Serializes concurrent reload calls via mutex
and propagates search re-index errors to the HTTP caller.
@perber
perber merged commit 6be05a1 into main Jun 26, 2026
9 checks passed
@perber
perber deleted the worktree-feat+fs-resync-signal branch June 26, 2026 14:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Feature request: admin-triggerable filesystem resync/reload endpoint

1 participant