{"id":46871,"library":"a-promise-queue","title":"A Promise Queue","description":"A lightweight, native ES6 promise queue library that supports concurrency, optional retry attempts for failed promises, and priority-based execution. Version 2.0.0 is the current stable release with an unknown release cadence. Unlike other promise queue libraries (e.g., p-limit or bottleneck), it offers built-in retry strategies and custom promise type support (e.g., Bluebird, Q). The library is primarily designed for Node.js and modern browsers with native Promise support.","status":"active","version":"2.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/e-e-e/a-promise-queue","tags":["javascript","queue","promise","es6","parallel","series"],"install":[{"cmd":"npm install a-promise-queue","lang":"bash","label":"npm"},{"cmd":"yarn add a-promise-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add a-promise-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default export only. Named import will result in undefined.","wrong":"const { PromiseQueue } = require('a-promise-queue')","symbol":"PromiseQueue","correct":"import PromiseQueue from 'a-promise-queue'"},{"note":"CJS users should use default require; no destructuring.","wrong":"const { default: PromiseQueue } = require('a-promise-queue')","symbol":"PromiseQueue (CommonJS)","correct":"const PromiseQueue = require('a-promise-queue')"},{"note":"The option key is lowercase 'promise', not 'Promise'. Incorrect casing silently defaults to native Promise.","wrong":"const queue = new PromiseQueue({ Promise: require('bluebird') })","symbol":"options.promise","correct":"const queue = new PromiseQueue({ promise: require('bluebird') })"}],"quickstart":{"code":"import PromiseQueue from 'a-promise-queue';\n\nconst delay = (ms) => () => new Promise(resolve => setTimeout(resolve, ms));\n\nconst queue = new PromiseQueue(() => console.log('Queue is empty'));\n\nqueue.add(delay(100)).then(() => console.log('first this'));\nqueue.add(() => Promise.reject('then this fails')).catch((e) => console.log('Errored:', e));\nqueue.add(delay(10)).then(() => console.log('and this succeeds'));\nqueue.add(delay(10), { priority: 1 }).then(() => console.log('but not before this one jumps the queue.'));\n\n// Wait for queue to finish\nqueue.flush().then(() => console.log('All done'));","lang":"javascript","description":"Demonstrates creating a queue with a completion callback, adding tasks with different delays and priorities, and handling rejections."},"warnings":[{"fix":"Use { promise: CustomPromise, concurrency: 3 } instead of { Promise: CustomPromise, Concurrency: 3 }.","message":"Options passed to constructor use lowercased keys (e.g., promise, concurrency). Common mistake: using 'Promise' instead of 'promise'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Check your option spelling: use { attempts: 3 } instead of { retries: 3 } or { attempts: 3 }.","message":"The `attempts` option in `queue.add` is misspelled as 'attempts' (not 'attempts' or 'retries'). The doc uses 'attemps' but the correct option key is 'attempts'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Understand that priority ordering only applies to tasks added before a flush. Use separate queues if you need priority across flushes.","message":"Priority is only respected within the same flush; after flush() is called, new tasks wait until flush completes.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2.0.0':26 'attempt':16 'base':23 'bluebird':61 'bottleneck':47 'browser':72 'built':51 'built-in':50 'cadenc':36 'concurr':13 'current':29 'custom':56 'design':67 'e.g':42,60 'es6':7,80 'execut':24 'fail':18 'javascript':77 'librari':10,41,64 'lightweight':5 'limit':45 'modern':71 'nativ':6,74 'node.js':69 'offer':49 'option':14 'p':44 'p-limit':43 'parallel':81 'primarili':66 'prioriti':22 'priority-bas':21 'promis':2,8,19,39,57,75,79 'q':62 'queue':3,9,40,78 'releas':31,35 'retri':15,53 'seri':82 'stabl':30 'strategi':54 'support':12,59,76 'type':58 'unknown':34 'unlik':37 'version':25","created_at":"2026-06-07T16:47:59.382751+00:00","updated_at":"2026-06-07T16:47:59.382751+00:00","problems":[{"fix":"Use default import: import PromiseQueue from 'a-promise-queue'; or const PromiseQueue = require('a-promise-queue');","cause":"Using named import ({ PromiseQueue }) instead of default import.","error":"TypeError: queue.add is not a function"},{"fix":"Ensure concurrency is a number and spelled correctly: { concurrency: 5 }","cause":"Passing concurrency option with misspelled key or as string.","error":"TypeError: options.concurrency is not a number"},{"fix":"Pass a valid Promise constructor as options.promise, e.g., require('bluebird') or use native Promise.","cause":"Passing a non-Promise value or invalid promise type in options.promise.","error":"TypeError: promise.then is not a function"}],"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/e-e-e/a-promise-queue#readme","github":"https://github.com/e-e-e/a-promise-queue","docs":null,"changelog":null,"pypi":null,"npm":"a-promise-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}}