From b263402091465f07c1d90d70a556cb406a8b193f Mon Sep 17 00:00:00 2001 From: nofarham <116541220+nofarham@users.noreply.github.com> Date: Mon, 22 Jan 2024 18:13:02 +0200 Subject: [PATCH] Fix node 18 (based on #711) --- lib/commands/query.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/lib/commands/query.js b/lib/commands/query.js index 0de52ff05a..1b3725d73f 100644 --- a/lib/commands/query.js +++ b/lib/commands/query.js @@ -279,7 +279,7 @@ class Query extends Command { }); this.on('end', () => { stream.push(null); // pushing null, indicating EOF - stream.emit('close'); // notify readers that query has completed + setImmediate(() => stream.emit('close')); // notify readers that query has completed }); this.on('fields', fields => { stream.emit('fields', fields); // replicate old emitter