Skip to content

Commit d912711

Browse files
maximpertsovpurplenicole730benjirewis
authored
rc-0.4.1 (#321)
Co-authored-by: purplenicole730 <[email protected]> Co-authored-by: benjirewis <[email protected]> Co-authored-by: maximpertsov <[email protected]>
1 parent d296141 commit d912711

File tree

2 files changed

+10
-3
lines changed

2 files changed

+10
-3
lines changed

pyproject.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[tool.poetry]
22
name = "viam-sdk"
3-
version = "0.4.0"
3+
version = "0.4.1"
44
description = "Viam Robotics Python SDK"
55
authors = [ "Naveed <[email protected]>" ]
66
license = "Apache-2.0"

src/viam/sessions_client.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import asyncio
2+
import sys
23
from datetime import timedelta
34
from typing import Optional
45

@@ -29,8 +30,14 @@
2930
)
3031

3132

33+
def loop_kwargs():
34+
if sys.version_info <= (3, 9):
35+
return {"loop": asyncio.get_running_loop()}
36+
return {}
37+
38+
3239
async def delay(coro, seconds):
33-
await asyncio.sleep(seconds)
40+
await asyncio.sleep(seconds, **loop_kwargs())
3441
await coro
3542

3643

@@ -42,14 +49,14 @@ class SessionsClient:
4249

4350
_current_id: str = ""
4451
_disabled: bool = False
45-
_lock = asyncio.Lock()
4652
_supported: Optional[bool] = None
4753
_heartbeat_interval: Optional[timedelta] = None
4854

4955
def __init__(self, channel: Channel, *, disabled: bool = False):
5056
self.channel = channel
5157
self.client = RobotServiceStub(channel)
5258
self._disabled = disabled
59+
self._lock = asyncio.Lock(**loop_kwargs())
5360

5461
listen(self.channel, SendRequest, self._send_request)
5562
listen(self.channel, RecvTrailingMetadata, self._recv_trailers)

0 commit comments

Comments
 (0)