Skip to content

Commit 9afbbfd

Browse files
committed
http: remove slow assert from hot path
1 parent f855cda commit 9afbbfd

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

lib/_http_server.js

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1006,7 +1006,9 @@ function resOnFinish(req, res, socket, state, server) {
10061006
// Usually the first incoming element should be our request. it may
10071007
// be that in the case abortIncoming() was called that the incoming
10081008
// array will be empty.
1009-
assert(state.incoming.length === 0 || state.incoming[0] === req);
1009+
if (state.incoming.length > 0 && state.incoming[0] !== req) {
1010+
throw new Error('Out of order response finish');
1011+
}
10101012

10111013
state.incoming.shift();
10121014

0 commit comments

Comments
 (0)