From aba3b94c1abf80de322ddd440ae379b2303084cf Mon Sep 17 00:00:00 2001 From: Olusegun Akintayo Date: Wed, 9 Nov 2022 02:38:48 +0400 Subject: [PATCH] Fix orphaned data warning (#16413) --- app/scripts/lib/stream-utils.js | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/app/scripts/lib/stream-utils.js b/app/scripts/lib/stream-utils.js index 6fa4d7a6c..cac30c066 100644 --- a/app/scripts/lib/stream-utils.js +++ b/app/scripts/lib/stream-utils.js @@ -9,6 +9,14 @@ import pump from 'pump'; */ export function setupMultiplex(connectionStream) { const mux = new ObjectMultiplex(); + /** + * We are using this streams to send keep alive message between backend/ui without setting up a multiplexer + * We need to tell the multiplexer to ignore them, else we get the " orphaned data for stream " warnings + * https://github.com/MetaMask/object-multiplex/blob/280385401de84f57ef57054d92cfeb8361ef2680/src/ObjectMultiplex.ts#L63 + */ + mux.ignoreStream('CONNECTION_READY'); + mux.ignoreStream('ACK_KEEP_ALIVE_MESSAGE'); + mux.ignoreStream('WORKER_KEEP_ALIVE_MESSAGE'); pump(connectionStream, mux, connectionStream, (err) => { if (err) { console.error(err);