lib: use process.nextTick() instead of setImmediate()

Do not delay the call to `stream.end()` too much.

PR-URL: https://github.com/nodejs/node/pull/42340
Refs: https://github.com/nodejs/node/pull/42340#issuecomment-1261163284
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>
This commit is contained in:
Luigi Pinca 2022-09-29 20:55:17 +02:00
parent 60de1476ea
commit 8dd635eb41

View File

@ -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);