From a0a8e06c5424d99d5f04c6781b45a5357e9129d5 Mon Sep 17 00:00:00 2001 From: Convly Date: Thu, 27 Oct 2022 16:00:07 +0200 Subject: [PATCH] Push values to stream from a regular loop instead of shifting the initial array --- packages/core/database/lib/query/helpers/streams/readable.js | 5 ++--- 1 file changed, 2 insertions(+), 3 deletions(-) diff --git a/packages/core/database/lib/query/helpers/streams/readable.js b/packages/core/database/lib/query/helpers/streams/readable.js index aa60981655..638c58dad4 100644 --- a/packages/core/database/lib/query/helpers/streams/readable.js +++ b/packages/core/database/lib/query/helpers/streams/readable.js @@ -160,9 +160,8 @@ class ReadableStrapiQuery extends Readable { this._fetched += count; // While there is at least one value to unpack - while (results.length) { - // Add the first one to the stream's queue - this.push(results.shift()); + for (const result of results) { + this.push(result); } // If the amount of fetched entities is smaller than the