diff options
author | Devaev Maxim <[email protected]> | 2021-05-26 12:26:31 +0300 |
---|---|---|
committer | Devaev Maxim <[email protected]> | 2021-05-26 12:26:31 +0300 |
commit | e4806297242c69fab8967b7e1d2d1a81dd17d744 (patch) | |
tree | ae61f672848a5e3289c6d75371b71c01e2bc1722 /kvmd/apps | |
parent | 5da412ae7cad952c58e5190aaabed39afd3cdb66 (diff) |
speed up msd
Diffstat (limited to 'kvmd/apps')
-rw-r--r-- | kvmd/apps/__init__.py | 1 | ||||
-rw-r--r-- | kvmd/apps/kvmd/__init__.py | 3 | ||||
-rw-r--r-- | kvmd/apps/kvmd/api/msd.py | 5 | ||||
-rw-r--r-- | kvmd/apps/kvmd/server.py | 3 |
4 files changed, 4 insertions, 8 deletions
diff --git a/kvmd/apps/__init__.py b/kvmd/apps/__init__.py index 9fc0c2bb..d930ed8f 100644 --- a/kvmd/apps/__init__.py +++ b/kvmd/apps/__init__.py @@ -331,7 +331,6 @@ def _get_config_scheme() -> Dict: "unix_rm": Option(True, type=valid_bool), "unix_mode": Option(0o660, type=valid_unix_mode), "heartbeat": Option(15.0, type=valid_float_f01), - "sync_chunk_size": Option(65536, type=functools.partial(valid_number, min=1024)), "access_log_format": Option("[%P / %{X-Real-IP}i] '%r' => %s; size=%b ---" " referer='%{Referer}i'; user_agent='%{User-Agent}i'"), }, diff --git a/kvmd/apps/kvmd/__init__.py b/kvmd/apps/kvmd/__init__.py index ae4f51a3..678b23e8 100644 --- a/kvmd/apps/kvmd/__init__.py +++ b/kvmd/apps/kvmd/__init__.py @@ -101,7 +101,6 @@ def main(argv: Optional[List[str]]=None) -> None: ), heartbeat=config.server.heartbeat, - sync_chunk_size=config.server.sync_chunk_size, keymap_path=config.hid.keymap, ignore_keys=config.hid.ignore_keys, @@ -109,6 +108,6 @@ def main(argv: Optional[List[str]]=None) -> None: mouse_y_range=(config.hid.mouse_y_range.min, config.hid.mouse_y_range.max), stream_forever=config.streamer.forever, - ).run(**config.server._unpack(ignore=["heartbeat", "sync_chunk_size"])) + ).run(**config.server._unpack(ignore=["heartbeat"])) get_logger(0).info("Bye-bye") diff --git a/kvmd/apps/kvmd/api/msd.py b/kvmd/apps/kvmd/api/msd.py index 5671dc08..0b8fa6e2 100644 --- a/kvmd/apps/kvmd/api/msd.py +++ b/kvmd/apps/kvmd/api/msd.py @@ -37,9 +37,8 @@ from ..http import get_multipart_field # ====== class MsdApi: - def __init__(self, msd: BaseMsd, sync_chunk_size: int) -> None: + def __init__(self, msd: BaseMsd) -> None: self.__msd = msd - self.__sync_chunk_size = sync_chunk_size # ===== @@ -80,7 +79,7 @@ class MsdApi: async with self.__msd.write_image(name): logger.info("Writing image %r to MSD ...", name) while True: - chunk = await data_field.read_chunk(self.__sync_chunk_size) + chunk = await data_field.read_chunk(self.__msd.get_upload_chunk_size()) if not chunk: break written = await self.__msd.write_image_chunk(chunk) diff --git a/kvmd/apps/kvmd/server.py b/kvmd/apps/kvmd/server.py index 2d58d81f..a5681580 100644 --- a/kvmd/apps/kvmd/server.py +++ b/kvmd/apps/kvmd/server.py @@ -158,7 +158,6 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins snapshoter: Snapshoter, heartbeat: float, - sync_chunk_size: int, keymap_path: str, ignore_keys: List[str], @@ -206,7 +205,7 @@ class KvmdServer(HttpServer): # pylint: disable=too-many-arguments,too-many-ins UserGpioApi(user_gpio), self.__hid_api, AtxApi(atx), - MsdApi(msd, sync_chunk_size), + MsdApi(msd), StreamerApi(streamer), ExportApi(info_manager, atx, user_gpio), RedfishApi(info_manager, atx), |