Don't watch inotify modify events because they fires on every write()

This commit is contained in:
Maxim Devaev
2024-10-28 17:20:13 +02:00
parent 60f413c1f4
commit 2195acf2ff
3 changed files with 11 additions and 10 deletions

View File

@@ -439,8 +439,8 @@ class Plugin(BaseMsd): # pylint: disable=too-many-instance-attributes
await asyncio.sleep(5)
with Inotify() as inotify:
await inotify.watch_all_modify(*self.__storage.get_watchable_paths())
await inotify.watch_all_modify(*self.__drive.get_watchable_paths())
await inotify.watch_all_changes(*self.__storage.get_watchable_paths())
await inotify.watch_all_changes(*self.__drive.get_watchable_paths())
# После установки вотчеров еще раз проверяем стейт,
# чтобы не потерять состояние привода.

View File

@@ -81,8 +81,8 @@ class Plugin(BaseUserGpioDriver):
await asyncio.sleep(5)
with Inotify() as inotify:
await inotify.watch_all_modify(os.path.dirname(self.__udc_path))
await inotify.watch_all_modify(self.__profile_path)
await inotify.watch_all_changes(os.path.dirname(self.__udc_path))
await inotify.watch_all_changes(self.__profile_path)
self._notifier.notify()
while True:
need_restart = False