Skip to content

refactor: compute service info request pacing from fresh clock reads - #1895

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

bdraco merged 1 commit into
masterfrom
request_pacing

Conversation

@bdraco

@bdraco bdraco commented Aug 30, 2026

Copy link
Copy Markdown
Member

Summary

Restructures the ServiceInfo.async_request polling loop the same way #1888 restructured the registration probe loop: wait-first if/continue shape, a fresh clock read at the top of each cycle, and deadline arithmetic in place of the carried now/next_/last trio. This is the last structural item from the tenth audit's inventory (#1835).

Details

  • Behavior preserved: fail at the deadline or on denial; the first query goes out immediately (QU unless a question type is passed, later queries QM); each send schedules the next at delay plus random jitter; the QM duplicate question escalation stands; every wake from a record update re-checks completeness; the listener is always removed.
  • Wait durations are computed from the current clock rather than a value cached before the previous send, so queries land on schedule instead of accumulating per-cycle lag.
  • The loop now reads the same way as async_check_service without being coupled to it. A shared pacing primitive was considered and rejected: the two loops differ in termination (probe count vs deadline/completion), cadence (fixed schedule vs adaptive jitter) and wake condition (engine notify vs the info's own futures), so extraction would be a callback-shaped abstraction bigger than the three lines it saves, with bound-method indirection in a Cythonized module.
  • Perf: one extra current_time_millis() call per query sent, in a loop whose iterations are separated by 25 to 1000 ms waits; no per-packet or per-record path changed and nothing in info.pxd is touched.

Test plan

  • full compiled test suite after REQUIRE_CYTHON=1 rebuild: 518 passed
  • pre-commit clean
  • four-agent simplify review: reuse, efficiency and altitude clean; the flatter loop shape it proposed was declined since it is the 2009 statement sequence this change retires

@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 (b110640) to head (2676b27).
⚠️ Report is 2 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1895   +/-   ##
=======================================
  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 request_pacing (2676b27) with master (b110640)

Open in CodSpeed

@bdraco
bdraco marked this pull request as ready for review August 30, 2026 03:30
@bdraco
bdraco merged commit 49aa15f into master Aug 30, 2026
41 checks passed
@bdraco
bdraco deleted the request_pacing branch August 30, 2026 03:30
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