Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/titarenko/speed-limit

Limit promised function calls in your node.js app
https://github.com/titarenko/speed-limit

Last synced: about 2 months ago
JSON representation

Limit promised function calls in your node.js app

Awesome Lists containing this project

README

        

# speed-limit

## Installation

```bash
npm i speed-limit
```

## Example

```js
var limit = require('speed-limit');

// note: it returns promise
function myFunc () {
return db('orders').whereNotNull('price');
}

// limit call rate to 1 call per 1 sec with jitter ±200 msec
var myFuncLimited = limit(myFunc, { limit: 1, per: 1000, jitter: 200 });
```

## License

MIT