mirror of
https://github.com/mofeng-git/One-KVM.git
synced 2026-02-01 02:21:53 +08:00
speed up msd
This commit is contained in:
@@ -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'"),
|
||||
},
|
||||
|
||||
@@ -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")
|
||||
|
||||
@@ -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)
|
||||
|
||||
@@ -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),
|
||||
|
||||
Reference in New Issue
Block a user