fix(watch): survive ENOSPC while adding a watch (#5033)
inotify_add_watch returns ENOSPC when max_user_watches is exhausted.
Log and skip that directory instead of killing the watcher.
(cherry picked from commit 3c4c84a017)
This commit is contained in:
1 parent
d81c4a9556
commit
23390d21b1
1 file changed
+10
-1
+10
-1
@@ -3709,7 +3709,16 @@ def watch(watch_path: Path, debounce: float = 3.0) -> None:
|
||||
"watchdog does not declare event_filter; read-only inotify "
|
||||
"events may overflow the queue and lose changes (#5033)"
|
||||
)
|
||||
watched[path] = observer.schedule(handler, str(path), **kwargs)
|
||||
try:
|
||||
watched[path] = observer.schedule(handler, str(path), **kwargs)
|
||||
except OSError as exc:
|
||||
if exc.errno == errno.ENOSPC:
|
||||
logger.warning(
|
||||
"inotify watch limit reached while watching %s; "
|
||||
"changes below it will be missed", path
|
||||
)
|
||||
return
|
||||
raise
|
||||
|
||||
def remove_tree(path: Path) -> None:
|
||||
path = path.resolve()
|
||||
|
||||
Reference in new issue
Block a user