Skip to content

feat: per-call timeout override and CancelledError propagation - #25

Merged
smaramwbc merged 2 commits into
mainfrom
feat/per-call-timeout-and-cancellation
Jun 16, 2026
Merged

feat: per-call timeout override and CancelledError propagation#25
smaramwbc merged 2 commits into
mainfrom
feat/per-call-timeout-and-cancellation

Conversation

@smaramwbc

Copy link
Copy Markdown
Owner

Summary

  • Add optional timeout: float | None = None to every public method on both StatewaveClient and AsyncStatewaveClient — when supplied it overrides the constructor-level timeout for that single call only
  • compile_memories_wait() uses request_timeout to avoid collision with its existing timeout (total polling duration) parameter
  • asyncio.CancelledError now re-raises immediately in the async _request() retry loop instead of being caught and retried; KeyboardInterrupt/SystemExit receive the same treatment in the sync loop

Test plan

  • 10 new unit tests in tests/test_per_call_timeout.py cover: timeout forwarded to httpx, absent when None, public-method passthrough, KeyboardInterrupt non-retry, CancelledError non-retry, retry-sleep cancellation, and compile_memories_wait request_timeout plumbing (sync + async)
  • Full suite: 92 tests pass (pytest --tb=short -q)
  • CI green on push

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).
@smaramwbc
smaramwbc merged commit 58e258f into main Jun 16, 2026
2 checks passed
@smaramwbc
smaramwbc deleted the feat/per-call-timeout-and-cancellation branch June 16, 2026 15:40
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