feat: live filesystem resync via SIGUSR1 signal#1206
Merged
Conversation
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
force-pushed
the
worktree-feat+fs-resync-signal
branch
from
June 26, 2026 13:06
a85039a to
3bab202
Compare
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.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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