Skip to content

refactor: compute probe pacing from fresh clock reads - #1888

Merged
bdraco merged 1 commit into
masterfrom
probe_pacing
Aug 30, 2026
Merged

bdraco merged 1 commit into
masterfrom
probe_pacing

Conversation

@bdraco

@bdraco bdraco commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Rework the probe pacing loop in async_check_service so the wait arithmetic uses fresh clock reads. The old loop reused a now cached before the previous send, so each probe went out late by the time spent sending, and the counter reset dance across i/now/next_time was hard to follow.

Details

  • Probes stay _CHECK_TIME apart on an absolute schedule (next_probe_at += _CHECK_TIME), matching the RFC 6762 section 8.1 probe interval; the wait is now computed against the current clock, so sends land on schedule instead of accumulating per-iteration lag.
  • Behavior is otherwise unchanged: a conflicting cached record still raises NonUniqueNameException or renames and restarts probing from zero, and every wake from async_wait (which record updates notify) re-checks for a conflict before waiting again.
  • The nested conflict while is flattened to an if/continue since the outer loop re-runs the check anyway.
  • Noticed while reviewing this loop during the [Previous Contributors Response Needed] Transition python-zeroconf to the Apache-2.0 License #1835 audit work; the restructure also retires the last of the 2009-era control flow there.

Test plan

  • full compiled test suite (REQUIRE_CYTHON=1 rebuild): 516 passed
  • pre-commit clean

@github-actions

Copy link
Copy Markdown

Thanks for contributing! A quick note: this project is in the process of moving from LGPL-2.1 to Apache 2.0, see #1835.

By continuing with this pull request you agree that this new contribution is offered under Apache 2.0.

This notice does not affect your previous contributions. If you would like to consent to relicensing those as well, please post the consent statement on #1835; silence is never treated as consent for past work.

If offering this contribution under Apache 2.0 does not work for you, no hard feelings; reply with the exact phrase I do not agree to the Apache 2.0 license or simply close this pull request.

@codecov

codecov Bot commented Aug 30, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 99.87%. Comparing base (f0a20a0) to head (cf5aa99).
⚠️ Report is 3 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1888   +/-   ##
=======================================
  Coverage   99.87%   99.87%           
=======================================
  Files          33       33           
  Lines        3910     3911    +1     
  Branches      568      568           
=======================================
+ Hits         3905     3906    +1     
  Misses          3        3           
  Partials        2        2           

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

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@codspeed

codspeed Bot commented Aug 30, 2026

Copy link
Copy Markdown

Merging this PR will not alter performance

✅ 24 untouched benchmarks


Comparing probe_pacing (cf5aa99) with master (ae524a5)

Open in CodSpeed

@bdraco
bdraco marked this pull request as ready for review August 30, 2026 01:13
@bdraco
bdraco merged commit 7737108 into master Aug 30, 2026
40 of 41 checks passed
@bdraco
bdraco deleted the probe_pacing branch August 30, 2026 01:14
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.

1 participant