Skip to content

Conversation

allenporter
Copy link
Contributor

Always reuse the existing asyncio loop rather than creating a new one.

This is needed to upgrade python-roborock in Home Assistant since the async shutdown call must happen in the same asyncio loop that was used to create the client.

This requires inlining all calls to get the currently running loop, because the constructor for the MQTT client needs to be created from outside the asyncio loop because the MQTT client does blocking I/O in the constructor. (example: home-assistant/core#124266). In the future we can move this back to the constructor, but that requires separately creating the MQTT client in a way that doesn't block, which we can do in the future when using a shared MQTT client as proposed by @Lash-L.

@allenporter allenporter requested a review from Lash-L January 28, 2025 04:29
@allenporter allenporter merged commit ed7db1f into Python-roborock:main Jan 28, 2025
6 checks passed
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