« get me outta code hell

node-utils: traverse: queue stat too - hsmusic-wiki - HSMusic - static wiki software cataloguing collaborative creation
about summary refs log tree commit diff
path: root/src/node-utils.js
diff options
context:
space:
mode:
author(quasar) nebula <qznebula@protonmail.com>2025-12-20 18:57:17 -0400
committer(quasar) nebula <qznebula@protonmail.com>2025-12-20 18:57:17 -0400
commit25d492fac5daf1b9a983792df06af41ecd8c3424 (patch)
treeed3688e5dfc818fc88525a29aaf878df5c8afa61 /src/node-utils.js
parentab038ee9aa304c7127ffd9832b236fb2a7a7a787 (diff)
node-utils: traverse: queue stat too
Diffstat (limited to 'src/node-utils.js')
-rw-r--r--src/node-utils.js5
1 files changed, 3 insertions, 2 deletions
diff --git a/src/node-utils.js b/src/node-utils.js
index d2e29b2f..8b81053d 100644
--- a/src/node-utils.js
+++ b/src/node-utils.js
@@ -83,12 +83,13 @@ export async function traverse(rootPath, {
     throw new Error(`Expected pathStyle to be device, posix, or win32`);
   }
 
-  const q_readdir = wrapQueue(readdir, queueSize);
+  const q_readdir = wrapQueue(readdir, Math.ceil(queueSize / 2));
+  const q_stat = wrapQueue(stat, Math.ceil(queueSize / 2));
 
   const recursive = (names, ...subdirectories) =>
     Promise.all(names.map(async name => {
       const devicePath = pathJoinDevice(rootPath, ...subdirectories, name);
-      const stats = await stat(devicePath);
+      const stats = await q_stat(devicePath);
 
       if (stats.isDirectory() && !filterDir(name)) return [];
       else if (stats.isFile() && !filterFile(name)) return [];