|
1 | | -import asyncio |
2 | 1 | from inspect import iscoroutinefunction |
3 | 2 | from threading import Lock |
4 | 3 | from typing import List, Mapping, Optional, Sequence, Tuple |
@@ -53,22 +52,20 @@ def __init__(self, address: str, *, log_level: int = logging.DEBUG) -> None: |
53 | 52 | self._ready = True |
54 | 53 | self._lock = Lock() |
55 | 54 |
|
56 | | - def _connect_to_parent(self): |
| 55 | + async def _connect_to_parent(self): |
57 | 56 | if self.parent is None: |
58 | 57 | if self._parent_address is None: |
59 | 58 | raise ValueError("Parent address not found") |
60 | | - self.parent = asyncio.run( |
61 | | - RobotClient.at_address( |
62 | | - self._parent_address, |
63 | | - RobotClient.Options( |
64 | | - dial_options=DialOptions(disable_webrtc=True, allow_insecure_with_creds_downgrade=True), |
65 | | - log_level=self._log_level, |
66 | | - ), |
67 | | - ) |
| 59 | + self.parent = await RobotClient.at_address( |
| 60 | + self._parent_address, |
| 61 | + RobotClient.Options( |
| 62 | + dial_options=DialOptions(disable_webrtc=True, insecure=True), |
| 63 | + log_level=self._log_level, |
| 64 | + ), |
68 | 65 | ) |
69 | 66 |
|
70 | 67 | async def _get_component(self, name: ResourceName) -> ComponentBase: |
71 | | - self._connect_to_parent() |
| 68 | + await self._connect_to_parent() |
72 | 69 | assert self.parent is not None |
73 | 70 | await self.parent.refresh() |
74 | 71 | return self.parent.get_component(name) |
|
0 commit comments