Skip to content

build: improve polling for mounted content - #2535

Open
ZluxYao wants to merge 1 commit into
jackyzha0:v5from
ZluxYao:fix/poll-mounted-content
Open

ZluxYao wants to merge 1 commit into
jackyzha0:v5from
ZluxYao:fix/poll-mounted-content

Conversation

@ZluxYao

@ZluxYao ZluxYao commented Aug 25, 2026

Copy link
Copy Markdown

Summary

  • watch existing content files directly when CHOKIDAR_USEPOLLING is enabled
  • periodically scan for files added or removed on mounted content
  • preserve the existing directory watcher for normal local filesystems
  • document the polling configuration
  • add tests for polling configuration and file reconciliation

Reproduction

Some network filesystems and Docker bind mounts do not reliably forward directory change events.

In an fnOS Docker deployment with WebDAV-synchronized content, polling the content directory did not detect changes, while polling individual files did.

This change only enables per-file watching and file discovery when polling is explicitly requested. The default native watcher remains unchanged.

Testing

  • npm run check
  • npm test (166 tests passed)
  • manually verified modification, addition, and deletion events in polling mode

This PR was written entirely using an LLM.

@github-actions

github-actions Bot commented Aug 25, 2026 •

Copy link
Copy Markdown
built with Refined Cloudflare Pages Action

⚡ Cloudflare Pages Deployment

Name Status Preview Last Commit
quartz ✅ Ready (View Log) Visit Preview 762f763

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🟡 Changes recommended

Minor implementation/documentation issues (misleading await on synchronous unwatch() and undocumented minimum scan interval behavior) should be corrected before merge.

Once you've addressed the issues Copilot identified, you can request another Copilot review.

Pull request overview

This PR improves Quartz’s watch mode reliability on network/mounted filesystems by switching to per-file watching when Chokidar polling is enabled and adding a periodic reconciliation scan to detect added/removed files, while preserving the existing directory watcher on normal filesystems.

Changes:

  • Added pollingEnabled and diffContentFiles utilities to support polling-mode behavior.
  • Updated startWatching to (optionally) watch existing files directly and periodically reconcile the watched file list.
  • Documented the polling configuration and added unit tests for the new utilities.
File summaries
File Description
quartz/util/contentWatcher.ts Adds helpers for detecting polling mode and diffing known vs current file sets.
quartz/util/contentWatcher.test.ts Adds unit tests for polling parsing and file set reconciliation.
quartz/build.ts Implements per-file watcher targets in polling mode plus periodic discovery/reconciliation.
docs/troubleshooting.md Documents how to enable polling for mounted/network content and tune intervals.
Review details
  • Files reviewed: 4/4 changed files
  • Comments generated: 2
  • Review effort level: Lite

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

Comment thread docs/troubleshooting.md
Comment on lines +178 to +179
Polling uses more CPU and filesystem I/O than native events. Increase `CHOKIDAR_INTERVAL` when
watching a large content directory or when immediate updates are not required.
Comment thread quartz/build.ts
Comment on lines +237 to +240
for (const fp of deleted) {
await watcher.unwatch(path.resolve(contentRoot, fp))
recordChange(fp, "delete")
}

This branch was successfully deployed

1 active deployment
Branch Preview — 762f7634 Deployed Aug 25, 2026 by github-actions[bot]
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.

2 participants