simplified AioNotifier()

This commit is contained in:
Maxim Devaev
2022-08-07 19:04:32 +03:00
parent aa630988cc
commit ec9785b4be
18 changed files with 43 additions and 54 deletions

View File

@@ -76,7 +76,7 @@ class Plugin(BaseUserGpioDriver):
while True:
try:
while True:
await self._notifier.notify()
self._notifier.notify()
if os.path.isfile(self.__udc_path):
break
await asyncio.sleep(5)
@@ -84,7 +84,7 @@ class Plugin(BaseUserGpioDriver):
with Inotify() as inotify:
inotify.watch(os.path.dirname(self.__udc_path), InotifyMask.ALL_MODIFY_EVENTS)
inotify.watch(self.__profile_path, InotifyMask.ALL_MODIFY_EVENTS)
await self._notifier.notify()
self._notifier.notify()
while True:
need_restart = False
need_notify = False
@@ -97,7 +97,7 @@ class Plugin(BaseUserGpioDriver):
if need_restart:
break
if need_notify:
await self._notifier.notify()
self._notifier.notify()
except Exception:
logger.exception("Unexpected OTG-bind watcher error")
await asyncio.sleep(1)