{"id":46378,"library":"simple-rate-limited-queue","title":"simple-rate-limited-queue","description":"A lightweight rate-limited queue for async operations in Node.js. v1.2.0 (stable, under 1KB gzipped, no dependencies). Limits operations per time interval and concurrent in-progress operations. Key differentiator: simple, minimal API with pause/resume/terminate and optional retry support via higher-order function. Ships TypeScript types. Released as needed; last update recent.","status":"active","version":"1.2.0","language":"javascript","source_language":"en","source_url":"https://github.com/i-like-robots/simple-rate-limited-queue","tags":["javascript","typescript"],"install":[{"cmd":"npm install simple-rate-limited-queue","lang":"bash","label":"npm"},{"cmd":"yarn add simple-rate-limited-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-rate-limited-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"ESM-only package; no CommonJS support.","wrong":"const RateLimitedQueue = require('simple-rate-limited-queue')","symbol":"RateLimitedQueue","correct":"import { RateLimitedQueue } from 'simple-rate-limited-queue'"},{"note":"Named export, not default.","wrong":"import withRetry from 'simple-rate-limited-queue'","symbol":"withRetry","correct":"import { withRetry } from 'simple-rate-limited-queue'"},{"note":"Types are bundled, no extra path needed; this entry is just to clarify that types are available.","wrong":"import { RateLimitedQueue } from 'simple-rate-limited-queue'","symbol":"RateLimitedQueue type (TypeScript)","correct":"import { RateLimitedQueue } from 'simple-rate-limited-queue//types'"}],"quickstart":{"code":"import { RateLimitedQueue, withRetry } from 'simple-rate-limited-queue';\n\nconst queue = new RateLimitedQueue({\n  maxPerInterval: 5,\n  maxInProgress: 2,\n  intervalLength: 1000\n});\n\nasync function fetchUser(id: number): Promise<any> {\n  const response = await queue.schedule(() => fetch(`https://api.example.com/users/${id}`));\n  return response.json();\n}\n\n// Usage\nfetchUser(1).then(console.log).catch(console.error);\n\n// With retry\nconst fetchWithRetry = withRetry(\n  (id: number) => fetch(`https://api.example.com/users/${id}`).then(r => r.json()),\n  (err: any, count: number) => count < 3 ? 1000 : undefined\n);\nqueue.schedule(() => fetchWithRetry(2)).then(console.log);","lang":"typescript","description":"Creates a rate-limited queue, schedules an async fetch operation, and shows retry logic on failure."},"warnings":[{"fix":"Wrap calls in try/catch or use .catch().","message":"Queue methods (schedule, token) will reject if the queue is terminated. Must handle rejection.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Use the withRetry helper and provide a shouldRetry callback.","message":"The queue does not automatically retry operations; use withRetry to implement retries manually.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Call queue.reset() after termination if you need to reuse the queue.","message":"Calling terminate() cancels all queued operations and prevents new ones. Use reset() to reuse the queue after termination.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'1kb':20 'api':39 'async':13 'concurr':30 'depend':23 'differenti':36 'function':50 'gzip':21 'higher':48 'higher-ord':47 'in-progress':31 'interv':28 'javascript':60 'key':35 'last':57 'lightweight':7 'limit':4,10,24 'minim':38 'need':56 'node.js':16 'oper':14,25,34 'option':43 'order':49 'pause/resume/terminate':41 'per':26 'progress':33 'queue':5,11 'rate':3,9 'rate-limit':8 'recent':59 'releas':54 'retri':44 'ship':51 'simpl':2,37 'simple-rate-limited-queu':1 'stabl':18 'support':45 'time':27 'type':53 'typescript':52,61 'updat':58 'v1.2.0':17 'via':46","created_at":"2026-06-07T12:59:37.885190+00:00","updated_at":"2026-06-07T12:59:37.885190+00:00","problems":[{"fix":"Use import syntax or convert your project to ESM.","cause":"Attempting to require() the ESM-only package in a CommonJS module.","error":"ERR_REQUIRE_ESM: Must use import to load ES Module: /path/to/node_modules/simple-rate-limited-queue/index.js"},{"fix":"Use import { RateLimitedQueue } from 'simple-rate-limited-queue'.","cause":"Importing default instead of named export.","error":"TypeError: queue.schedule is not a function"},{"fix":"Call queue.reset() before scheduling new operations after termination.","cause":"Trying to schedule an operation after calling terminate() without reset().","error":"Error: The queue has been terminated"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/i-like-robots/simple-rate-limited-queue","github":"https://github.com/i-like-robots/simple-rate-limited-queue","docs":null,"changelog":null,"pypi":null,"npm":"simple-rate-limited-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["testing"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}