New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

dumb-limiter

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dumb-limiter

A very simple rate limiter.

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
1
decreased by-85.71%
Maintainers
1
Weekly downloads
 
Created
Source

dumb-limiter

A simple and performant limiter that executes your tasks in order with the possibility of parallelization (which is not the case of dumb-queue).

Install

npm install @pyrsmk/dumb-limiter

Usage

// Initialize the limiter with a wait time of 1000ms.
const limiter = require('dumb-limiter')(1000)

// The callback must return a promise so`the queue know when the task has finished.
limiter(() => someAsyncSlowAction1())
// ...
// Further in your code.
limiter(() => someAsyncSlowAction2())
// ...
// You can, of course, use non-async functions with the help of `async` which will
// always return a promise.
limiter(async () => someSyncSlowAction3())

The tasks are called as soon they are added to the limiter stack, anywhere in your app.

Compatibility

Node 8+

Keywords

FAQs

Package last updated on 05 Apr 2022

Did you know?

Socket

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc