palantir / conjure-rust-runtime

Rust implementation of the Conjure runtime
10 stars 7 forks source link

The response isn't returned until the request body is fully written #146

Open sfackler opened 1 year ago

sfackler commented 1 year ago

https://github.com/palantir/conjure-rust-runtime/blob/develop/conjure-runtime/src/service/retry.rs#L241-L242

We join on the response headers future and the request body write futures currently. This means that a request flow that's designed to be full-duplex won't work properly. This is probably a really obscure case but we should do better. We may need to e.g. spawn the request body write off onto a new task if request headers come in before the body write completes.

sfackler commented 1 year ago

This would require streaming bodies to be 'static which would be a breaking change and potentially undesirable in other contexts.

sfackler commented 1 year ago

We could alternatively stash the request writer in the response body and have response reads "drive" the request write. It would involve adding a lifetime parameter to ResponseBody but that's probably fine.