Skip to content

Commit 2624a3e

Browse files
committed
pass in loop for python versions 3.9 and earlier
1 parent a7f08cd commit 2624a3e

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

src/viam/sessions_client.py

Lines changed: 8 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,13 @@
2930
)
3031

3132

33+
def loop_kwargs():
34+
loop = asyncio.get_running_loop()
35+
return {"loop": loop} if sys.version_info[:2] <= (3, 9) else {}
36+
37+
3238
async def delay(coro, seconds):
33-
await asyncio.sleep(seconds)
39+
await asyncio.sleep(seconds, **loop_kwargs())
3440
await coro
3541

3642

@@ -42,7 +48,7 @@ class SessionsClient:
4248

4349
_current_id: str = ""
4450
_disabled: bool = False
45-
_lock = asyncio.Lock()
51+
_lock = asyncio.Lock(**loop_kwargs())
4652
_supported: Optional[bool] = None
4753
_heartbeat_interval: Optional[timedelta] = None
4854

0 commit comments

Comments
 (0)