diff options
| author | (quasar) nebula <qznebula@protonmail.com> | 2025-12-20 19:47:17 -0400 |
|---|---|---|
| committer | (quasar) nebula <qznebula@protonmail.com> | 2025-12-20 19:47:17 -0400 |
| commit | 4b6de9bc45ec840ebda44c62f66f601a70a211cd (patch) | |
| tree | 0f0d717e17bd5284af88950fe9e475136640201b /src/common-util | |
| parent | 73fcf6c666273af5d7bf31338dc3b8ec0af58ad5 (diff) | |
Revert "sugar: wrapQueue, use this in traverse"
This reverts commit ab038ee9aa304c7127ffd9832b236fb2a7a7a787.
Diffstat (limited to 'src/common-util')
| -rw-r--r-- | src/common-util/sugar.js | 29 |
1 files changed, 0 insertions, 29 deletions
diff --git a/src/common-util/sugar.js b/src/common-util/sugar.js index fba06d76..354cf5cc 100644 --- a/src/common-util/sugar.js +++ b/src/common-util/sugar.js @@ -395,35 +395,6 @@ export function queue(functionList, queueSize = 50) { return promiseList; } -export function wrapQueue(fn, queueSize = 50) { - if (queueSize === 0) return fn; - - let running = 0; - let resume = []; - - let proceed = (...args) => { - running++; - return Promise.try(fn, ...args).finally(() => { - running--; - if (resume.length) { - resume.shift()(); - } - }); - }; - - return (...args) => { - if (running === queueSize) { - return new Promise(resolve => { - resume.push(resolve); - }).then(() => { - return proceed(...args); - }); - } else { - return proceed(...args); - } - }; -} - export function delay(ms) { return new Promise((res) => setTimeout(res, ms)); } |