Skip to content

Commit

Permalink
server: treat self.device as future (#1401)
Browse files Browse the repository at this point in the history
* server: treat self.device as future

* simplify

* modify annotation

* modify annotation
  • Loading branch information
bjia56 committed Mar 29, 2024
1 parent 3c1801a commit 878753a
Showing 1 changed file with 2 additions and 2 deletions.
4 changes: 2 additions & 2 deletions server/python/plugin_remote.py
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,7 @@ class DeviceProxy(object):
def __init__(self, systemManager: SystemManager, id: str):
self.systemManager = systemManager
self.id = id
self.device: asyncio.Future[rpc.RpcPeer] = None
self.device: asyncio.Future[rpc.RpcProxy] = None

def __getattr__(self, name):
if name == 'id':
Expand All @@ -81,7 +81,7 @@ def __setattr__(self, name: str, value: Any) -> None:

def __apply__(self, method: str, args: list):
if not self.device:
self.device = self.systemManager.api.getDeviceById(self.id)
self.device = asyncio.ensure_future(self.systemManager.api.getDeviceById(self.id))

async def apply():
device = await self.device
Expand Down

0 comments on commit 878753a

Please sign in to comment.