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: speed up the query handler #1350
Conversation
This reverts commit 9a7f6cd.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## master #1350 +/- ##
=======================================
Coverage 99.75% 99.75%
=======================================
Files 30 30
Lines 3240 3243 +3
Branches 536 536
=======================================
+ Hits 3232 3235 +3
Misses 5 5
Partials 3 3 ☔ View full report in Codecov by Sentry. |
out_queue = self.zc.out_queue | ||
out_queue.async_add(now, question_answers.mcast_aggregate) | ||
if question_answers.mcast_aggregate_last_second: | ||
# https://datatracker.ietf.org/doc/html/rfc6762#section-14 | ||
# If we broadcast it in the last second, we have to delay | ||
# at least a second before we send it again | ||
out_delay_queue = self.zc.out_delay_queue | ||
out_delay_queue.async_add(now, question_answers.mcast_aggregate_last_second) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
out_queue
and out_delay_queue
never change, we could rebind them to the QueryHandler object to avoid the getattr here but it probably doesn't make much difference as they should rarely be called in practice
handle_assembled_query
was still a bound method on theZeroconf
object. It can be moved to the query handler like we did for the record manager. This meant the listener had to jump back into the python stack for every answer packet when most of them will never be responded to.