Hot Reload
Contents
OnyxFolio watches your vault for file changes and reloads automatically on the next request. There is no file watcher process — the check happens in the request path.
How it works
On every incoming request, maybe_reload() runs:
- Checks the newest file modification time across all vault files.
- Compares it against the last known scan time.
- If anything changed, re-runs the full
load_posts()pipeline and swaps in the new data.
A 2-second debounce prevents multiple simultaneous reloads — if a request arrives within 2 seconds of the last check, the check is skipped.
What triggers a reload
Any change to any file in the vault directory:
- Editing a
.mdnote - Creating or deleting a note
- Adding or removing media files in
_attachments/ - Modifying frontmatter
Thread safety
Reloads are protected by a threading.Lock. If two requests arrive simultaneously and both detect a change, only one performs the reload — the other skips it and serves the previous (stale-by-milliseconds) data.
Development workflow
- Start the server:
python3 app.py - Edit notes in Obsidian (or any editor)
- Save and refresh the browser — the change is live
No --watch flags. No separate process. No restart.
Production note
Hot reload also works in production. When you push a vault update and Coolify rebuilds the Docker image, the new vault is loaded at startup. If you're running a long-lived process (gunicorn) with the vault mounted as a volume, changes are picked up automatically on the next request.
See also
- Getting Started — running the development server
- Deployment — production deployment with Coolify