/
๐Ÿ“

Bottleneck - NodeJS Task Scheduler and Rate Limiter

https://github.com/SGrondin/bottleneck
javascriptnode

Bottleneck is a lightweight and zero-dependency Task Scheduler and Rate Limiter for Node.js and the browser.

Bottleneck is an easy solution as it adds very little complexity to your code. It is battle-hardened, reliable and production-ready and used on a large scale in private companies and open source software.

It supports Clustering: it can rate limit jobs across multiple Node.js instances. It uses Redis and strictly atomic operations to stay reliable in the presence of unreliable clients and networks. It also supports Redis Cluster and Redis Sentinel.

js
import Bottleneck from "bottleneck";
// execute 3 requests per second:
const limiter = new Bottleneck({
minTime: 333,
});
Edit this page
logo
Code-related notes and snippets