
Security News
Browserslist-rs Gets Major Refactor, Cutting Binary Size by Over 1MB
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
async-queue-manager
Advanced tools
A wrapper over async queue helpful in managing the queue length.
A wrapper over async queue helpful in managing the queue length
// inputArray of huge length (approx 1000 or more)
const lowWaterMark = 40; // whatever you want it to be
const highWaterMark = 100; // whatever you want it to be
function main(inputArray) {
const queue = async.queue(worker, 20);
async function worker(input, cb) {
console.log("queue length -->", queue.length());
if (queue.length() <= lowWaterMark) queueManager.resume();
await doSomething(input);
return cb();
}
const queueManager = new QueueManager(queue);
for (const input of inputArray) {
if (queue.length() >= highWaterMark) await queueManager.pause(); // pauses the loop till queue length has decreased below low watermark
queue.push(input);
}
}
Let's say that you have to load a huge csv file from disk or maybe s3 into memory, convert it into json chunks and do some procesing over it. If you're using (for example) a micro instance (which may already have some heavy processes running) then you only have limited amount of memory and after loading the entire csv file into memory you don't want your queue to use too much memory too. This is where queue manager helps you in pausing and waiting for your queue to clear up a bit before you start loading it again.
FAQs
A wrapper over async queue helpful in managing the queue length.
The npm package async-queue-manager receives a total of 13 weekly downloads. As such, async-queue-manager popularity was classified as not popular.
We found that async-queue-manager demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Browserslist-rs now uses static data to reduce binary size by over 1MB, improving memory use and performance for Rust-based frontend tools.
Research
Security News
Eight new malicious Firefox extensions impersonate games, steal OAuth tokens, hijack sessions, and exploit browser permissions to spy on users.
Security News
The official Go SDK for the Model Context Protocol is in development, with a stable, production-ready release expected by August 2025.