Skip to content
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: optimize processing of records in RecordUpdateListener subclasses #1231

Merged
merged 3 commits into from Aug 22, 2023

Conversation

bdraco
Copy link
Member

@bdraco bdraco commented Aug 22, 2023

These classes used to process a single record at a time, but since we now process them all in batches, we can remove all the breakout functions. This will also fix futures not resolving since the legacy backcompat was partially broken in info.py

This removes the legacy update_record as its been a few years now from info.py (it was never called anyways except in tests), but leaves the one in _updates.py for back-compat as it appears some libs are not updated yet

def update_record( # pylint: disable=no-self-use

def update_record(self, zc: 'Zeroconf', now: float, record: Optional[DNSRecord]) -> None:

@codecov
Copy link

codecov bot commented Aug 22, 2023

Codecov Report

Patch coverage: 100.00% and project coverage change: -0.04% ⚠️

Comparison is base (47d3c7a) 99.82% compared to head (1893c2d) 99.78%.
Report is 1 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master    #1231      +/-   ##
==========================================
- Coverage   99.82%   99.78%   -0.04%     
==========================================
  Files          25       25              
  Lines        2795     2790       -5     
  Branches      480      479       -1     
==========================================
- Hits         2790     2784       -6     
  Misses          3        3              
- Partials        2        3       +1     
Files Changed Coverage Δ
src/zeroconf/_updates.py 100.00% <ø> (ø)
src/zeroconf/__init__.py 100.00% <100.00%> (ø)
src/zeroconf/_services/browser.py 99.14% <100.00%> (ø)
src/zeroconf/_services/info.py 100.00% <100.00%> (ø)

... and 1 file with indirect coverage changes

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@bdraco bdraco changed the title feat: optimize processing of records in RecordUpdateListener feat: optimize processing of records in RecordUpdateListener subclasses Aug 22, 2023
@bdraco bdraco force-pushed the collapse_service_browser_branching branch 2 times, most recently from 85d6c2b to 775b1da Compare August 22, 2023 17:45
These classes used to process a single record at a time, but since
we now process them all in batches, we can remove all the breakout
functions
@bdraco bdraco force-pushed the collapse_service_browser_branching branch from 775b1da to dbda037 Compare August 22, 2023 17:50
bdraco added a commit to bdraco/esphome that referenced this pull request Aug 22, 2023
The first step of removing the legacy update_record is in
python-zeroconf/python-zeroconf#1231

This prepares esphome for this as its been deprecated for a few years and
this one was missed
@bdraco bdraco marked this pull request as ready for review August 22, 2023 18:23
@bdraco bdraco merged commit 3e89294 into master Aug 22, 2023
33 of 34 checks passed
@bdraco bdraco deleted the collapse_service_browser_branching branch August 22, 2023 18:23
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

1 participant