From 8e9434cdd5bb99e8171f80126960141dd4b8f85e Mon Sep 17 00:00:00 2001 From: Nuckyz <61953774+Nuckyz@users.noreply.github.com> Date: Thu, 23 May 2024 21:57:12 -0300 Subject: [PATCH] Make reporter faster --- scripts/generateReport.ts | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/scripts/generateReport.ts b/scripts/generateReport.ts index 32e6a3262..bb5c39ac7 100644 --- a/scripts/generateReport.ts +++ b/scripts/generateReport.ts @@ -440,10 +440,13 @@ async function runtime(token: string) { wreq = webpackRequire; Vencord.Webpack.factoryListeners.add(factory => { - let isResolved = false; - searchAndLoadLazyChunks(String(factory)).then(() => isResolved = true); + // setImmediate to avoid blocking the factory patching execution while checking for lazy chunks + setTimeout(() => { + let isResolved = false; + searchAndLoadLazyChunks(String(factory)).then(() => isResolved = true); - chunksSearchPromises.push(() => isResolved); + chunksSearchPromises.push(() => isResolved); + }, 0); }); // setImmediate to only search the initial factories after Discord initialized the app