Provide an asyncio class for service registration#347
Conversation
13d04d6 to
81e3e2d
Compare
jstasiak
left a comment
There was a problem hiding this comment.
I think we should rename the aio module to async or something, I'll imagine it'll be more familiar to the users (and rolls of the keyboard more naturally, at least to me).
All on all I'm really happy to see this change and with few tweaks it should be ready for merging!
Python has problems with modules named I can call it |
|
Huh, that's something that I didn't have in mind at all (the |
Lets do that 👍 |
Codecov Report
@@ Coverage Diff @@
## master #347 +/- ##
==========================================
+ Coverage 91.71% 92.15% +0.44%
==========================================
Files 2 4 +2
Lines 2678 2780 +102
Branches 361 367 +6
==========================================
+ Hits 2456 2562 +106
+ Misses 148 146 -2
+ Partials 74 72 -2
Continue to review full report at Codecov.
|
|
At this point, I'm going to write the changes to use this in
to make sure the use cases are covered. |
- When using zeroconf with async code, service registration can cause the
executor to overload when registering multiple services since each one
will have to wait a bit between sending the broadcast. An aio subclass
is now available as aio.AsyncZeroconf that implements the following
- async_register_service
- async_unregister_service
- async_update_service
- async_close
I/O is currently run in the executor to provide backwards compat with
existing use cases.
These functions avoid overloading the executor by waiting in the event
loop instead of the executor threads.
53ad3ce to
f9f3e68
Compare
- Add async version of check_service
|
Retested, everything working as expected 👍 |
|
If this looks like its ready, it would be great to get a release so I can start updating packages to use the new async calls. |
|
Very nice work! I'll release this shortly. |
|
Version 0.30.0 has just been relased with this change. |
|
Thanks! |
When using zeroconf with async code, service registration can cause the
executor to overload when registering multiple services since each one
will have to wait a bit between sending the broadcast. An asyncio class
is now available as aio.AsyncZeroconf that implements the following
I/O is currently run in the executor to provide backwards compat with
existing use cases.
These functions avoid overloading the executor by waiting in the event
loop instead of the executor threads.
The existing Zeroconf object is available as
.zeroconfVarious tests that do not need to broadcast records no longer do so
as this slows down the test for something not being tested