summaryrefslogtreecommitdiff
path: root/kvmd/inotify.py
diff options
context:
space:
mode:
authorMaxim Devaev <[email protected]>2023-03-17 23:41:59 +0200
committerMaxim Devaev <[email protected]>2023-03-17 23:41:59 +0200
commitdbb9eda3416a79a26bb6b738aecab0c43c8c84e5 (patch)
treef730671f358ec6f0adad5edddfe008760476b2e8 /kvmd/inotify.py
parent166cb8e3b7a08dd6b56ac317b58e7b280dcb3bef (diff)
refactoring
Diffstat (limited to 'kvmd/inotify.py')
-rw-r--r--kvmd/inotify.py17
1 files changed, 9 insertions, 8 deletions
diff --git a/kvmd/inotify.py b/kvmd/inotify.py
index fe9b6391..b66ca443 100644
--- a/kvmd/inotify.py
+++ b/kvmd/inotify.py
@@ -190,14 +190,15 @@ class Inotify:
self.__events_queue: "asyncio.Queue[InotifyEvent]" = asyncio.Queue()
- async def watch(self, path: str, mask: int) -> None:
- path = os.path.normpath(path)
- assert path not in self.__wd_by_path, path
- get_logger().info("Watching for %s", path)
- # Асинхронно, чтобы не висло на NFS
- wd = _inotify_check(await aiotools.run_async(libc.inotify_add_watch, self.__fd, _fs_encode(path), mask))
- self.__wd_by_path[path] = wd
- self.__path_by_wd[wd] = path
+ async def watch(self, mask: int, *paths: str) -> None:
+ for path in paths:
+ path = os.path.normpath(path)
+ assert path not in self.__wd_by_path, path
+ get_logger().info("Watching for %s", path)
+ # Асинхронно, чтобы не висло на NFS
+ wd = _inotify_check(await aiotools.run_async(libc.inotify_add_watch, self.__fd, _fs_encode(path), mask))
+ self.__wd_by_path[path] = wd
+ self.__path_by_wd[wd] = path
# def unwatch(self, path: str) -> None:
# path = os.path.normpath(path)