Skip to content

Commit

Permalink
lib: use process.nextTick() instead of setImmediate()
Browse files Browse the repository at this point in the history
Do not delay the call to `stream.end()` too much.

PR-URL: #42340
Refs: #42340 (comment)
Reviewed-By: Michaël Zasso <[email protected]>
Reviewed-By: Juan José Arboleda <[email protected]>
Reviewed-By: Yagiz Nizipli <[email protected]>
Reviewed-By: Darshan Sen <[email protected]>
Reviewed-By: Antoine du Hamel <[email protected]>
  • Loading branch information
lpinca authored and danielleadams committed Jan 3, 2023
1 parent facb606 commit 9ccf8b2
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion lib/internal/js_stream_socket.js
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ class JSStreamSocket extends Socket {

const handle = this._handle;

setImmediate(() => {
process.nextTick(() => {
// Ensure that write is dispatched asynchronously.
this.stream.end(() => {
this.finishShutdown(handle, 0);
Expand Down

0 comments on commit 9ccf8b2

Please sign in to comment.