diff options
author | Devaev Maxim <[email protected]> | 2018-07-02 11:00:36 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2018-07-02 11:00:36 +0300 |
commit | 54faa8ab7e2e83528fddae4b24b6d14ef206fcae (patch) | |
tree | 29fda9cdd36c01f3432d92a86d99ab6d05cf42cf /kvmd | |
parent | a396b676184e9b6feaee86fb48dca8781fa9e6e2 (diff) |
using run_in_executor() for os.fsync()
Diffstat (limited to 'kvmd')
-rw-r--r-- | kvmd/kvmd/msd.py | 3 |
1 files changed, 2 insertions, 1 deletions
diff --git a/kvmd/kvmd/msd.py b/kvmd/kvmd/msd.py index 98ce07bc..fe9cb5a9 100644 --- a/kvmd/kvmd/msd.py +++ b/kvmd/kvmd/msd.py @@ -107,6 +107,7 @@ class MassStorageDevice: def __init__(self, bind: str, init_delay: float, loop: asyncio.AbstractEventLoop) -> None: self._bind = bind self.__init_delay = init_delay + self.__loop = loop self.__device_info: Optional[DeviceInfo] = None self._lock = asyncio.Lock() @@ -172,7 +173,7 @@ class MassStorageDevice: size = len(data) await self._device_file.write(data) await self._device_file.flush() - os.fsync(self._device_file.fileno()) + await self.__loop.run_in_executor(None, os.fsync, self._device_file.fileno()) self.__writed += size return self.__writed |