New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: significantly improve efficiency of the ServiceBrowser scheduler #1335
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
bdraco
commented
Dec 14, 2023
bdraco
commented
Dec 14, 2023
bdraco
commented
Dec 14, 2023
Its working as expected and we get a heck of lot less queries we don't need to send. Need to profile it to make sure all the schedule/reschedule/cancels are not too slow |
performance looks great. Sadly there are a lot of tests that check the internals because of scheduling... maybe we need a async_fire_time_changed instead to move time forward to avoid that |
bdraco
commented
Dec 14, 2023
bdraco
commented
Dec 15, 2023
bdraco
added a commit
to bdraco/home-assistant
that referenced
this pull request
Dec 16, 2023
changelog: python-zeroconf/python-zeroconf@0.129.0...0.130.0 Major traffic reduction (fixed python-zeroconf/python-zeroconf#821 and python-zeroconf/python-zeroconf#1337) The ServiceBrower query scheduler has been rewritten from the ground up to use a heapq: python-zeroconf/python-zeroconf#1335 ServiceInfo requests are now aware of history and will now space asking questions far enough apart to avoid being suppressed python-zeroconf/python-zeroconf#1348
20 tasks
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
The query scheduled was sub-optimal because we will schedule a query in the future when a PTR will be close to expiring, but if the PTR is seen again between when it was scheduled and we ask again, we still ask. This lead to an order of magnitude (frequently even 2 orders of magnitude) more queries than needed to rescue records from expiration.
This is a complete rewrite of the ServiceBrowser query scheduler.
fixes #821
replaces and closes #1171
Work tracking:
schedule_rescue_query