Skip to content

fix: lazily create async streaming requests - #183

Open
abhinavkr26104 wants to merge 1 commit into
browserbase:mainfrom
abhinavkr26104:fix/issue-175-async-stream-context
Open

fix: lazily create async streaming requests#183
abhinavkr26104 wants to merge 1 commit into
browserbase:mainfrom
abhinavkr26104:fix/issue-175-async-stream-context

Conversation

@abhinavkr26104

Copy link
Copy Markdown

Summary

  • defer creation of async streaming request coroutines until the response context manager is entered
  • apply the lazy behavior to both standard and custom streamed response wrappers
  • add regression coverage for discarded context managers and normal enter/close behavior

Why

Creating an async streaming context manager previously allocated a coroutine immediately. Discarding an unentered manager therefore emitted a RuntimeWarning for an unawaited coroutine.

Fixes #175

Testing

  • python -m pytest tests/test_response.py -q -n 0 (30 passed)
  • full suite with Steady: 1220 passed, 8 skipped, plus 4 pre-existing Windows/environment failures tracked in Make the test suite deterministic on Windows and proxied environments #181
  • full suite excluding those four known failures: 1220 passed, 8 skipped, 4 deselected
  • python -m ruff check .
  • python -m mypy src/browserbase/_response.py

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.

Async streaming response wrappers leak an unawaited coroutine when not entered

1 participant