feat: per-call timeout override and CancelledError propagation - #25
Merged
Conversation
Add optional `timeout: float | None = None` to every public method on both StatewaveClient and AsyncStatewaveClient. When provided it overrides the constructor-level timeout for that individual HTTP call only; when omitted the client's configured default applies unchanged. compile_memories_wait() uses `request_timeout` to avoid collision with its existing `timeout` (total polling duration) parameter. asyncio.CancelledError now propagates immediately from the async retry loop instead of being caught and retried. KeyboardInterrupt and SystemExit receive the same treatment in the sync loop. 10 new unit tests cover: timeout forwarding to httpx, no kwarg when None, public-method passthrough, interrupt non-retry, and compile_memories_wait request_timeout plumbing (sync + async).
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.
Summary
timeout: float | None = Noneto every public method on bothStatewaveClientandAsyncStatewaveClient— when supplied it overrides the constructor-level timeout for that single call onlycompile_memories_wait()usesrequest_timeoutto avoid collision with its existingtimeout(total polling duration) parameterasyncio.CancelledErrornow re-raises immediately in the async_request()retry loop instead of being caught and retried;KeyboardInterrupt/SystemExitreceive the same treatment in the sync loopTest plan
tests/test_per_call_timeout.pycover: timeout forwarded to httpx, absent whenNone, public-method passthrough,KeyboardInterruptnon-retry,CancelledErrornon-retry, retry-sleep cancellation, andcompile_memories_waitrequest_timeoutplumbing (sync + async)pytest --tb=short -q)