-
Notifications
You must be signed in to change notification settings - Fork 24
Ensure streams get closed and don't wait on concurrent futures in crt #443
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| self.response: R | None = None | ||
|
|
||
| async def await_output(self) -> tuple[R, AsyncEventReceiver[O]]: | ||
| async_reader = AsyncBytesReader((await self._awaitable_response).body) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is formatted a bit unfortunately. I just wrapped it in a try/except
| if self._received_chunks: | ||
| return self._received_chunks.popleft() | ||
| elif self._stream.completion_future.done(): | ||
| elif self._completion_future.done(): |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Note that async futures return immediately on done, whereas concurrent futures can wait... forever
By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.