Skip to content

Conversation

@Lash-L
Copy link
Collaborator

@Lash-L Lash-L commented Feb 24, 2023

wait_for creates a task, async_timeout does the same work and avoids the task creation

This is one of the current optimizations they are making on HA core.

Sorry to be making so many PRS!

wait_for creates a task, async_timeout does the same work and avoids the task creation
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

@humbertogontijo humbertogontijo merged commit 311af16 into Python-roborock:main Mar 1, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants