Skip to content

Commit

Permalink
http2: send out pending data earlier
Browse files Browse the repository at this point in the history
If there’s a lot of data waiting on a given stream, send
it out early, if possible. This helps trigger the backpressure
mechanism introduced in 8a4a193 at a better time.

PR-URL: #29398
Reviewed-By: David Carlier <[email protected]>
Reviewed-By: James M Snell <[email protected]>
  • Loading branch information
addaleax authored and BethGriggs committed Oct 17, 2019
1 parent e8c90bf commit 66387cd
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/node_http2.cc
Original file line number Diff line number Diff line change
Expand Up @@ -1224,7 +1224,10 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle,
stream->inbound_consumed_data_while_paused_ += avail;

// If we have a gathered a lot of data for output, try sending it now.
if (session->outgoing_length_ > 4096) session->SendPendingData();
if (session->outgoing_length_ > 4096 ||
stream->available_outbound_length_ > 4096) {
session->SendPendingData();
}
} while (len != 0);

// If we are currently waiting for a write operation to finish, we should
Expand Down

0 comments on commit 66387cd

Please sign in to comment.