Skip to content

Commit 66387cd

Browse files
addaleaxBethGriggs
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 e8c90bf commit 66387cd

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
@@ -1224,7 +1224,10 @@ int Http2Session::OnDataChunkReceived(nghttp2_session* handle,
12241224
stream->inbound_consumed_data_while_paused_ += avail;
12251225

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

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

0 commit comments

Comments
 (0)