Skip to content

Implement duplicate question supression#770

Merged
bdraco merged 28 commits into
python-zeroconf:masterfrom
bdraco:duplicate_question_suppression
Jun 20, 2021
Merged

Implement duplicate question supression#770
bdraco merged 28 commits into
python-zeroconf:masterfrom
bdraco:duplicate_question_suppression

Conversation

@bdraco

@bdraco bdraco commented Jun 20, 2021

Copy link
Copy Markdown
Member

https://datatracker.ietf.org/doc/html/rfc6762#section-7.3

7.3. Duplicate Question Suppression

If a host is planning to transmit (or retransmit) a query, and it
sees another host on the network send a query containing the same
"QM" question, and the Known-Answer Section of that query does not
contain any records that this host would not also put in its own
Known-Answer Section, then this host SHOULD treat its own query as
having been sent. When multiple queriers on the network are querying
for the same resource records, there is no need for them to all be
repeatedly asking the same question.

Fixes #721

@bdraco bdraco marked this pull request as draft June 20, 2021 17:50
Comment thread zeroconf/_core.py Outdated
@bdraco

bdraco commented Jun 20, 2021

Copy link
Copy Markdown
Member Author

Need to make sure we do not record QU questions as we can only suppress QM questions

@codecov-commenter

codecov-commenter commented Jun 20, 2021

Copy link
Copy Markdown

Codecov Report

Merging #770 (5942e91) into master (b5d54e4) will decrease coverage by 0.01%.
The diff coverage is 100.00%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master     #770      +/-   ##
==========================================
- Coverage   98.41%   98.39%   -0.02%     
==========================================
  Files          20       21       +1     
  Lines        2204     2240      +36     
  Branches      375      380       +5     
==========================================
+ Hits         2169     2204      +35     
  Misses         22       22              
- Partials       13       14       +1     
Impacted Files Coverage Δ
zeroconf/_core.py 97.88% <100.00%> (+0.01%) ⬆️
zeroconf/_dns.py 100.00% <100.00%> (ø)
zeroconf/_handlers.py 100.00% <100.00%> (ø)
zeroconf/_history.py 100.00% <100.00%> (ø)
zeroconf/_services/browser.py 98.09% <100.00%> (+0.04%) ⬆️
zeroconf/const.py 97.46% <100.00%> (+0.03%) ⬆️
zeroconf/_utils/aio.py 95.74% <0.00%> (-2.13%) ⬇️

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 b5d54e4...5942e91. Read the comment docs.

@bdraco

bdraco commented Jun 20, 2021

Copy link
Copy Markdown
Member Author

Verified its only suppressing what it should

2021-06-20 18:44:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 18:44:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 18:47:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 18:47:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 18:54:54 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 18:54:54 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:02:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:02:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:06:54 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:06:54 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:11:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:11:24 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:15:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:15:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:18:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:18:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:22:34 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:22:34 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:30:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:30:04 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:40:34 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:40:34 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:52:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:52:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:55:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:55:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:58:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 19:58:44 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:05:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:05:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:07:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:07:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:08:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:08:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:10:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:10:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:11:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:11:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:17:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:17:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:19:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:19:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:22:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:22:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:23:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:23:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:25:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:25:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:26:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:26:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:34:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:34:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:40:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:40:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:44:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:44:30 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:52:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 20:52:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 21:01:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history
2021-06-20 21:01:00 DEBUG (MainThread) [zeroconf] Asking ptr[question,QM,in,_googlecast._tcp.local.] was suppressed by the question history

@bdraco bdraco marked this pull request as ready for review June 20, 2021 22:34
@bdraco bdraco merged commit c0f4f48 into python-zeroconf:master Jun 20, 2021
@bdraco bdraco deleted the duplicate_question_suppression branch June 20, 2021 22:41
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Multi service browsers of the same type create excessive queries

2 participants