Security News
tea.xyz Spam Plagues npm and RubyGems Package Registries
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
express-queue
Advanced tools
Readme
Express middleware to limit a number of simultaneously processing requests using queue
If you have different needs regarding the functionality, please add a feature request.
npm install --save express-queue
var express = require('express');
var queue = require('express-queue');
var app = express();
// Using queue middleware
app.use(queue({ activeLimit: 2, queuedLimit: -1 }));
// activeLimit - max request to process simultaneously
// queuedLimit - max requests in queue until reject (-1 means do not reject)
// rejectHandler - handler to call when queuedLimit is reached (see below)
//
// May be also:
// app.get('/api', queue({ activeLimit: 2, queuedLimit: -1})
You can access MiniQueue object used internally. To get current queue length you may do following:
const express = require('express');
const expressQueue = require('../');
const queueMw = expressQueue({ activeLimit: 2, queuedLimit: -1 });
const app = express();
app.use(queueMw);
console.log(`queueLength: ${queueMw.queue.getLength()}`);
For more info on Queue object used refer to npmjs.com/package/mini-queue package docs and/or source code.
If you set queuedLimit, when the queue is full, the middleware will reject any incoming request.
The default handler will send a 503 status code, but you can setup your own handler with rejectHandler
option, e.g.:
const queueMw = expressQueue({ activeLimit: 2, queuedLimit: 6, rejectHandler: (req, res) => { res.sendStatus(500); } });
Please, refer to ./examples/
directory for a working example.
github.com npmjs.com travis-ci.org coveralls.io inch-ci.org
MIT
FAQs
Express middleware to limit a number of simultaneously processing requests using queue
The npm package express-queue receives a total of 5,840 weekly downloads. As such, express-queue popularity was classified as popular.
We found that express-queue 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
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.
Security News
UnitedHealth Group disclosed that the ransomware attack on Change Healthcare compromised protected health information for millions in the U.S., with estimated costs to the company expected to reach $1 billion.