{"id":46617,"library":"throttled-queue","title":"throttled-queue","description":"Rate-limit arbitrary asynchronous or synchronous code with a FIFO queue that drains at a controlled interval. Version 3.0.0 is current, actively maintained, and ships TypeScript definitions. Unlike lodash throttle, throttled-queue never drops executions — every call is queued and executed at the configured rate. Supports browser and Node.js, with optional even spacing and convenience helpers (seconds, minutes, hours). Breaking changes from v2: named import required, options passed as single object.","status":"active","version":"3.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/shaunpersad/throttled-queue","tags":["javascript","node","rate limit","queue","throttle","throttled","request","typescript"],"install":[{"cmd":"npm install throttled-queue","lang":"bash","label":"npm"},{"cmd":"yarn add throttled-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add throttled-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Version 3 switched to a named export. Default import works only in v2 and below.","wrong":"import throttledQueue from 'throttled-queue'","symbol":"throttledQueue","correct":"import { throttledQueue } from 'throttled-queue'"},{"note":"CommonJS require must destructure the named export.","wrong":"const throttledQueue = require('throttled-queue')","symbol":"require('throttled-queue')","correct":"const { throttledQueue } = require('throttled-queue')"},{"note":"Convenience helper for interval. Also available: minutes, hours.","wrong":null,"symbol":"seconds","correct":"import { seconds } from 'throttled-queue'"},{"note":"Optional TypeScript type import for the options object.","wrong":null,"symbol":"ThrottledQueueOptions","correct":"import type { ThrottledQueueOptions } from 'throttled-queue'"}],"quickstart":{"code":"import { throttledQueue, seconds } from 'throttled-queue';\n\nconst throttle = throttledQueue({\n  maxPerInterval: 5,\n  interval: seconds(1),  // or 1000ms\n  evenlySpaced: true,\n});\n\nfor (let i = 0; i < 20; i++) {\n  throttle(() => {\n    console.log(`Request ${i} at ${Date.now()}`);\n  });\n}","lang":"typescript","description":"Creates a throttle that allows up to 5 executions per second, with even spacing. Queues 20 requests; logs each with timestamp."},"warnings":[{"fix":"Use `import { throttledQueue } from 'throttled-queue'` and pass options as `{ maxPerInterval, interval, evenlySpaced }`.","message":"Version 3 changes import syntax from default to named export and options from positional arguments to a single object.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use helpers like `seconds(1)` or pass `1000` explicitly for one second.","message":"The `interval` option expects milliseconds. Using `seconds` etc. is recommended to avoid unit confusion.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Consider whether even spacing is important; omit or set to `false` for immediate queuing.","message":"If `evenlySpaced` is set to `true`, the queue will space executions evenly over the interval. With small intervals or high concurrency, this can delay the first execution.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Wrap in try/catch or attach .catch() to each throttled call.","message":"The throttle does not automatically retry or handle failures. The promise returned by `throttle(fn)` rejects if the function throws or returns a rejected promise.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Upgrade to v3 with the new options object syntax.","message":"In version 2, `throttledQueue(maxPerInterval, interval, evenlySpaced)` was the signature. This is deprecated and removed in v3.","severity":"deprecated","affected_versions":">=2.0.0 <3.0.0"}],"env_vars":null,"search_vec":"'3.0.0':23 'activ':26 'arbitrari':7 'asynchron':8 'break':65 'browser':52 'call':42 'chang':66 'code':11 'configur':49 'control':20 'conveni':60 'current':25 'definit':31 'drain':17 'drop':39 'even':57 'everi':41 'execut':40,46 'fifo':14 'helper':61 'hour':64 'import':70 'interv':21 'javascript':77 'limit':6,80 'lodash':33 'maintain':27 'minut':63 'name':69 'never':38 'node':78 'node.js':54 'object':76 'option':56,72 'pass':73 'queu':44 'queue':3,15,37,81 'rate':5,50,79 'rate-limit':4 'request':84 'requir':71 'second':62 'ship':29 'singl':75 'space':58 'support':51 'synchron':10 'throttl':2,34,36,82,83 'throttled-queu':1,35 'typescript':30,85 'unlik':32 'v2':68 'version':22","created_at":"2026-06-07T13:00:47.806957+00:00","updated_at":"2026-06-07T13:00:47.806957+00:00","problems":[{"fix":"Change to `import { throttledQueue } from 'throttled-queue'`.","cause":"Using default import in v3 instead of named import.","error":"TypeError: throttledQueue is not a function"},{"fix":"Use `const { throttledQueue } = require('throttled-queue')`.","cause":"Using CommonJS require without destructuring.","error":"TypeError: throttledQueue is not a function"},{"fix":"Ensure interval is a number in milliseconds, e.g., `interval: 1000` or `interval: seconds(1)`.","cause":"Passing NaN, string, or undefined as interval value.","error":"Error: The \"interval\" option must be a positive number."},{"fix":"Use a positive integer like `maxPerInterval: 5`.","cause":"Passing zero, negative number, or non-integer.","error":"Error: The \"maxPerInterval\" option must be a positive integer."}],"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/shaunpersad/throttled-queue#readme","github":"https://github.com/shaunpersad/throttled-queue","docs":null,"changelog":null,"pypi":null,"npm":"throttled-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}}