Skip to content

Commit 9359dfe

Browse files
committed
tools: rpc: timeouts from RPC wrapper
Allow RPC wrappers to overwrite the default 10 seconds timeout. Signed-off-by: Jordan Yates <jordan@embeint.com>
1 parent 1a29ccd commit 9359dfe

2 files changed

Lines changed: 5 additions & 0 deletions

File tree

src/infuse_iot/commands.py

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -60,6 +60,10 @@ def auth_level(self) -> Auth:
6060
"""Authentication level to run command with"""
6161
return Auth.DEVICE
6262

63+
def command_timeout_ms(self) -> int:
64+
"""Duration to wait for the RPC response in milliseconds"""
65+
return 10000
66+
6367
def request_struct(self) -> ctypes.LittleEndianStructure | bytes:
6468
"""RPC_CMD request structure"""
6569
raise NotImplementedError

src/infuse_iot/tools/rpc.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,7 @@ def run(self):
8585
with self._client.connection(self._id, types, self._args.conn_timeout) as mtu:
8686
self._max_payload = mtu
8787
rpc_client = RpcClient(self._client, mtu, self._id, self.rx_handler)
88+
rpc_client.set_timeout(self._command.command_timeout_ms())
8889
params = bytes(self._command.request_struct())
8990

9091
if hasattr(self._command.response, "vla_from_buffer_copy"): # type: ignore

0 commit comments

Comments
 (0)