Conversation
…er__ on owned-client path When WebhookSender owns the client (_owns_client=True), __aenter__ was unconditionally calling _get_client(), which allocates an AsyncClient that goes unused until __aexit__ on the owned-client path. The client is created lazily on the first _send_bytes call instead. Closes #300 https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
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.
Closes #300
When
WebhookSenderowns its client (_owns_client=True, i.e. no caller-suppliedclient=),__aenter__was unconditionally calling_get_client(), which allocated anhttpx.AsyncClientthat sat idle until__aexit__. On the owned-client path,_send_bytescalls_get_client()lazily at first use anyway, so the eager allocation in__aenter__was wasted. The fix skips it; the operator-supplied-client branch (_owns_client=False) still calls_get_client()for symmetry, though that call is a no-op sinceself._clientis already set.What was tested
pytest tests/ -k "webhook_sender or webhook"— 182 passed, 0 failedruff check src/— cleanmypy src/adcp/webhook_sender.py— no new errors (pre-existing errors are in unrelated files)Pre-PR review
_get_client()call on_owns_client=Falsebranch is a harmless no-op but could be removed for clarity.async with WebhookSender(...)paths (owned and operator-supplied) preserve their existing contract; no docstring update needed.Session: https://claude.ai/code/${CLAUDE_CODE_REMOTE_SESSION_ID}
Generated by Claude Code