Skip to content

Commit

Permalink
core: buffer body for retries (#511)
Browse files Browse the repository at this point in the history
Description: set stream options to buffer stream body for retries.
Risk Level: med - the client now buffers stream body for retries.
Testing: local - lyft and example apps.

Signed-off-by: Jose Nino <[email protected]>
Signed-off-by: JP Simard <[email protected]>
  • Loading branch information
junr03 authored and jpsim committed Nov 28, 2022
1 parent 912fe30 commit 90e0ea5
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion mobile/library/common/http/dispatcher.cc
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,14 @@ envoy_status_t Dispatcher::startStream(envoy_stream_t new_stream_handle,
std::make_unique<DirectStreamCallbacks>(new_stream_handle, bridge_callbacks, *this);

AsyncClient& async_client = getClient();
AsyncClient::Stream* underlying_stream = async_client.start(*callbacks, {});
// Note: currently all streams are set to buffer body data for retries.
// This is done as an assumption that almost all client calls are retriable,
// and the penalty for those that are not is minimal.
// The stream options could be exposed
// (like in: https://github.com/lyft/envoy-mobile/pull/456/) in the future,
// if the library needs the added configuration flexiblity.
AsyncClient::Stream* underlying_stream =
async_client.start(*callbacks, AsyncClient::StreamOptions().setBufferBodyForRetry(true));

if (!underlying_stream) {
// TODO: this callback might fire before the startStream function returns.
Expand Down

0 comments on commit 90e0ea5

Please sign in to comment.