Skip to content

Only wake up the query loop when there is a change in the next query time#818

Merged
bdraco merged 18 commits into
python-zeroconf:masterfrom
bdraco:abtract_query_scheduler
Jun 23, 2021
Merged

Only wake up the query loop when there is a change in the next query time#818
bdraco merged 18 commits into
python-zeroconf:masterfrom
bdraco:abtract_query_scheduler

Conversation

@bdraco

@bdraco bdraco commented Jun 22, 2021

Copy link
Copy Markdown
Member

The ServiceBrowser query loop (async_browser_task) was being awoken on
every packet because it was using zeroconf.async_wait which wakes
up on every new packet. We only need to awaken the loop when the next time
we are going to send a query has changed.

fixes #814 fixes #768

@bdraco bdraco changed the title Only wake up the query loop when there is a change in the next query time. Only wake up the query loop when there is a change in the next query time Jun 23, 2021
@codecov-commenter

codecov-commenter commented Jun 23, 2021

Copy link
Copy Markdown

Codecov Report

Merging #818 (7f49c61) into master (a7b4f8e) will increase coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #818      +/-   ##
==========================================
+ Coverage   98.61%   98.62%   +0.01%     
==========================================
  Files          22       22              
  Lines        2303     2328      +25     
  Branches      395      396       +1     
==========================================
+ Hits         2271     2296      +25     
  Misses         21       21              
  Partials       11       11              
Impacted Files Coverage Δ
zeroconf/_services/browser.py 98.35% <100.00%> (+0.18%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update a7b4f8e...7f49c61. Read the comment docs.

@bdraco

bdraco commented Jun 23, 2021

Copy link
Copy Markdown
Member Author

While this is much better and reliable, the scheduling is still 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.

@bdraco bdraco marked this pull request as ready for review June 23, 2021 03:06
@bdraco bdraco merged commit 4062fe2 into python-zeroconf:master Jun 23, 2021
@bdraco bdraco deleted the abtract_query_scheduler branch June 23, 2021 03:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

2 participants