
Product
Introducing Pull Request Stories to Help Security Teams Track Supply Chain Risks
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
multi-throttle
Advanced tools
This middleware throttles the number of concurrent requests and the numbers of requests within in a given interval. Requests that exceed the limit of requests / interval are added to a queue and will be executed once current requests finish execution. If
This middleware throttles the number of concurrent requests and the numbers of requests within in a given interval.
Requests that exceed the limit of requests / interval are added to a queue and will be executed once current requests
finish execution.
If the number of queued requests exceeds the value for maxQueueSize
, the requests will be dropped until an item is
removed from the queue.
npm install -S multi-throttle
Add the middleware to your express app and adjust the configuration options.
import express from 'express';
import multiThrottle from 'multi-throttle';
const app = express();
app.use(multiThrottle({
/**
* The number of maximum allowed requests in the given interval
*/
maxRequests: 10,
/**
* The interval within which the maxRequest limit is enforced in ms
*/
interval: 1000,
/**
* Maximum number of concurrent running requests
*/
maxConcurrency: 5,
/**
* Maximum number of queued requests before incoming requests are dropped
*/
maxQueueSize: 10,
/**
* Optional:
* Function to send custom response object / status code when a request is dropped.
*/
handleError?: (req: express.Request, res: express.Response) => void
}));
FAQs
This middleware throttles the number of concurrent requests and the numbers of requests within in a given interval. Requests that exceed the limit of requests / interval are added to a queue and will be executed once current requests finish execution. If
We found that multi-throttle 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.
Product
Socket’s new Pull Request Stories give security teams clear visibility into dependency risks and outcomes across scanned pull requests.
Research
/Security News
npm author Qix’s account was compromised, with malicious versions of popular packages like chalk-template, color-convert, and strip-ansi published.
Research
Four npm packages disguised as cryptographic tools steal developer credentials and send them to attacker-controlled Telegram infrastructure.