Skip to content

fix: lazy inotify directory watches for fast startup (closes #324) - #552

Merged
s2x merged 3 commits into
masterfrom
fix/issue-324-lazy-inotify-directory-walk
Jul 3, 2026
Merged

fix: lazy inotify directory watches for fast startup (closes #324)#552
s2x merged 3 commits into
masterfrom
fix/issue-324-lazy-inotify-directory-walk

Conversation

@s2x

@s2x s2x commented Jul 3, 2026

Copy link
Copy Markdown
Collaborator

Description

Closes #324

Changes

  • InotifyMonitorWatcher::start() now watches only top-level source directories at boot instead of doing a synchronous full recursive walk
  • InotifyMonitorWatcher::deferredWalk() is a new private method that recursively walks and watches all existing subdirectories, scheduled via Worker::$globalEvent->delay() after the event loop starts
  • Added watchedPaths reverse-lookup map for O(1) duplicate detection
  • pathByWd cleanup on IN_IGNORED now also removes the path from watchedPaths
  • Tests updated: testStartWatchesOnlyTopLevelDirectories (was testStartRecursivelyWatchesDirectories), added testDeferredWalkWatchesAllSubdirectories, and updated event-loop mocks

Changelog

Performance: Optimize InotifyMonitorWatcher startup by deferring the recursive directory walk to after the event loop starts, eliminating synchronous full-directory walk on very large source trees.

Code Review

  • Passed subagent code review
  • All review comments addressed

@s2x s2x self-assigned this Jul 3, 2026
@s2x
s2x merged commit 9e4dc48 into master Jul 3, 2026
12 checks passed
@s2x
s2x deleted the fix/issue-324-lazy-inotify-directory-walk branch July 3, 2026 21:02
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.

[Performance] InotifyMonitorWatcher recursive startup walk can be slow on very large source trees

1 participant