
Research
/Security News
Contagious Interview Campaign Escalates With 67 Malicious npm Packages and New Malware Loader
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
@balena/promise-queue
Advanced tools
Queue sync or async functions with max concurrency, max size, max age, and fifo/lifo ordering
This module allows you to queue sync/async functions with max concurrency, max size, max-age, and fifo/lifo ordering
let q = new PromiseQueue({
name: 'device_logs',
concurrency: 40,
maxSize: 400,
maxAge: 30 * 1000,
order: 'fifo'
});
export function middleware(
req: Request,
res: Response,
next: NextFunction,
): void {
q.add(() =>
new Promise(resolve => {
res.once('close', resolve);
res.once('finish', resolve);
next();
}),
)
.catch(err => {
if (err instanceof PromiseQueueError) {
reject(res);
}
});
}
PromiseQueue.metrics
is an EventEmitter
which emits the following events:
arrival
, data: undefined
: a promise arrives at the queue
queueLength
, data: number
: the length of the queue on arrival
inFlight
, data: number
: the number of active promises on arrival
dequeue
, data: undefined
: a promise stops waiting in the queue and starts processing
queueTime
, data: number
: time a promise spent waiting in queue on dequeue
completion
, data: undefined
: a promise completes processing
serviceTime
, data: number
: time a promise spent processing on completion
latency
, data: number
: sum of queueTime and serviceTime on completion
rejection
, data: undefined
: a promise to be added is rejected because maxSize
is already reached
timeout
, data: undefined
: a promise's latency (queue time + service time) exceeds maxAge
, and it is rejected
v1.3.2
FAQs
Queue sync or async functions with max concurrency, max size, max age, and fifo/lifo ordering
The npm package @balena/promise-queue receives a total of 358 weekly downloads. As such, @balena/promise-queue popularity was classified as not popular.
We found that @balena/promise-queue demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 3 open source maintainers 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.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.
Security News
Meet Socket at Black Hat & DEF CON 2025 for 1:1s, insider security talks at Allegiant Stadium, and a private dinner with top minds in software supply chain security.
Security News
CAI is a new open source AI framework that automates penetration testing tasks like scanning and exploitation up to 3,600× faster than humans.