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
1 change: 1 addition & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ roborock = "roborock.cli:main"
python = "^3.8"
click = ">=8"
aiohttp = "*"
async-timeout = "*"
pycryptodome = "~3.16.0"
pycryptodomex = {version = "~3.16.0", markers = "sys_platform == 'darwin'"}
paho-mqtt = "~1.6.1"
Expand Down
7 changes: 5 additions & 2 deletions roborock/roborock_queue.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import asyncio
from asyncio import Queue
from typing import Any
import async_timeout

from roborock import RoborockException

Expand All @@ -12,7 +13,9 @@ def __init__(self, protocol: int, *args):
self.protocol = protocol

async def async_put(self, item: tuple[Any, RoborockException | None], timeout: float | int) -> None:
return await asyncio.wait_for(self.put(item), timeout=timeout)
async with async_timeout.timeout(timeout):
await self.put(item)
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can put return back here if you would like, but I think it is not needed, since put does not return anything


async def async_get(self, timeout: float | int) -> tuple[Any, RoborockException | None]:
return await asyncio.wait_for(self.get(), timeout=timeout)
async with async_timeout.timeout(timeout):
return await self.get()
Empty file added tests/test_api.py
Empty file.