Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "viam-sdk"
version = "0.4.0"
version = "0.4.1"
description = "Viam Robotics Python SDK"
authors = [ "Naveed <naveed@viam.com>" ]
license = "Apache-2.0"
Expand Down
11 changes: 9 additions & 2 deletions src/viam/sessions_client.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
import asyncio
import sys
from datetime import timedelta
from typing import Optional

Expand Down Expand Up @@ -29,8 +30,14 @@
)


def loop_kwargs():
if sys.version_info <= (3, 9):
return {"loop": asyncio.get_running_loop()}
return {}


async def delay(coro, seconds):
await asyncio.sleep(seconds)
await asyncio.sleep(seconds, **loop_kwargs())
await coro


Expand All @@ -42,14 +49,14 @@ class SessionsClient:

_current_id: str = ""
_disabled: bool = False
_lock = asyncio.Lock()
_supported: Optional[bool] = None
_heartbeat_interval: Optional[timedelta] = None

def __init__(self, channel: Channel, *, disabled: bool = False):
self.channel = channel
self.client = RobotServiceStub(channel)
self._disabled = disabled
self._lock = asyncio.Lock(**loop_kwargs())

listen(self.channel, SendRequest, self._send_request)
listen(self.channel, RecvTrailingMetadata, self._recv_trailers)
Expand Down