perf(doctor): probe channels concurrently instead of sequentially - #579
Open
An-idd wants to merge 1 commit into
Open
perf(doctor): probe channels concurrently instead of sequentially#579An-idd wants to merge 1 commit into
An-idd wants to merge 1 commit into
Conversation
Reimplements Panniantong#406 on latest main, addressing all three close reasons: - Keeps main's scrub_url_credentials boundary — every result message (success and error paths) is scrubbed in _check_one. - Serializes overlapping doctor runs with a module-level lock so concurrent check_all callers can't cross-contaminate the registry singletons' active_backend; channels within one run still probe in parallel. - No wall-clock assertions: the concurrency test uses a threading Barrier that only all-at-once execution can pass, plus a two-run test proving active_backend isolation. Wall time drops from sum(probe times) to ~max(probe times) — measured 2.2×–3.6× on real installed states in Panniantong#406. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
cschett13-collab
approved these changes
Aug 6, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Reimplementation of #406 on latest main, addressing each close reason:
Close reasons → fixes
scrub_url_credentialsis kept as the final output boundary in_check_one— both the success path and the exception path go through it (existing scrub tests still pass unchanged).check_all()runs, so concurrent doctor callers can't cross-contaminate the singletons'active_backend. Channels within one run still probe in parallel, so the perf win is unaffected. New test spawns two concurrent doctor runs against one singleton and asserts each gets its own backend.threading.Barrier(8): it only passes if all 8 probes run simultaneously; sequential execution deterministically fails via barrier timeout. Registry ordering is also asserted (format_reportrelies on it;ThreadPoolExecutor.mappreserves input order).Why
Each
check()does real subprocess/network probing with multi-second timeouts (rdt statuswaits up to 10s), so sequential wall time = Σ(probe times); concurrent ≈ max(probe times). Measured 2.2×–3.6× on real installed states — full benchmark methodology and raw trials in #406.Tests
pytest tests/ -v: 588 passed, 16 subtests passed.🤖 Generated with Claude Code