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 <targos@protonmail.com>
Reviewed-By: Juan José Arboleda <soyjuanarbol@gmail.com>
Reviewed-By: Yagiz Nizipli <yagiz@nizipli.com>
Reviewed-By: Darshan Sen <raisinten@gmail.com>
Reviewed-By: Antoine du Hamel <duhamelantoine1995@gmail.com>
  • 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
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.