Skip to content

Commit fa949ca

Browse files
addaleaxtargos
authored andcommitted
http2: send out pending data earlier
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]>
1 parent c95e9ca commit fa949ca

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

src/node_http2.cc

+4-1
Original file line numberDiff line numberDiff line change
@@ -1221,7 +1221,10 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle,
12211221
stream->inbound_consumed_data_while_paused_ += avail;
12221222

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

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

0 commit comments

Comments
 (0)