Skip to content

Conversation

@JordonPhillips
Copy link
Contributor

This updates the CRT bindings to write data to its ByteIO body asynchronously rather than buffering it all into memory when making a call. This should enable us to support event streaming, and also prevent us from buffering a huge amount of data into memory, even for synchronous bodies of uncertain size.

This should also allow us to get rid of those consume_body utility functions that I detest. But one thing at a time.

Also, we really need to work on standing up a local http2 server for testing. Integ tests will be nice too and all but I'm nevertheless nervous about how hard this is to test.

By submitting this pull request, I confirm that you can use, modify, copy, and redistribute this contribution, under the terms of your choice.

@JordonPhillips JordonPhillips requested a review from a team as a code owner October 17, 2024 15:17
@JordonPhillips
Copy link
Contributor Author

This is also blocking on the protocol test skips that are in #318

@JordonPhillips JordonPhillips changed the base branch from develop to suppress-new-protocol-tests October 18, 2024 13:57
Base automatically changed from suppress-new-protocol-tests to develop October 18, 2024 15:40
This updates the CRT bindings to write data to its ByteIO body
asynchronously rather than buffering it all into memory when making
a call. This should enable us to support event streaming, and also
prevent us from buffering a huge amount of data into memory, even
for synchronous bodies of uncertain size.
Comment on lines +335 to +336
# Should we call close here? Or will that make the crt unable to read the last
# chunk?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have we tested this at all? My initial impression is we'd throw a ValueError in the CRT trying to read from a closed object. I would think this gets cleaned up for us automatically once it goes out of scope?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The problem is that it's hard to test the CRT without a live connection. If nothing else, the BytesIO will eventually get garbage collected since when this task complete there'll be no more references to it.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe add a mark this with a TODO so we know to come back eventually? Otherwise, that seems fine.

Fix comment typos

Co-authored-by: Nate Prewitt <nate.prewitt@gmail.com>
@JordonPhillips JordonPhillips merged commit 882603b into develop Oct 18, 2024
5 checks passed
@JordonPhillips JordonPhillips deleted the http-stream-support branch October 18, 2024 20:42
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.

2 participants