{"id":46846,"library":"yqueue","title":"YQueue","description":"YQueue is a concurrent priority task queue for Node.js (v1.0.1, ~monthly releases). It provides concurrency control, prioritized tasks, and error handling for batch operations. Unlike p-limit or bottleneck, YQueue offers both a simple queue and a batch mode with backpressure via `maxQueueLength`. Supports async hooks and best-effort error stack traces. Ships TypeScript types. Lightweight with zero runtime dependencies.","status":"active","version":"1.0.1","language":"javascript","source_language":"en","source_url":"git@github.com:innopals/yqueue","tags":["javascript","nodejs","queue","concurrent","typescript"],"install":[{"cmd":"npm install yqueue","lang":"bash","label":"npm"},{"cmd":"yarn add yqueue","lang":"bash","label":"yarn"},{"cmd":"pnpm add yqueue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"YQueue is a named export, not default. Both ESM and CJS work via named export.","wrong":"import YQueue from 'yqueue'","symbol":"YQueue","correct":"import { YQueue } from 'yqueue'"},{"note":"Correct in both ESM and CJS; CommonJS require('yqueue') works but is not the recommended ESM pattern.","wrong":"const YBatch = require('yqueue').YBatch","symbol":"YBatch","correct":"import { YBatch } from 'yqueue'"},{"note":"Exported class for batch error handling, rarely used directly.","wrong":null,"symbol":"YBatchErrors","correct":"import { YBatchErrors } from 'yqueue'"}],"quickstart":{"code":"import { YQueue, YBatch } from 'yqueue';\n\n// Queue example\nconst queue = new YQueue({ concurrency: 2 });\n\nqueue.run(async () => {\n  const result = await fetch('https://api.example.com');\n  return result.json();\n}, { priority: 1 }).then(data => console.log(data));\n\n// Batch example\nconst batch = new YBatch({ concurrency: 3, maxQueueLength: 5 });\nfor (let i = 0; i < 10; i++) {\n  batch.add(async () => {\n    await new Promise(resolve => setTimeout(resolve, 100));\n    return i;\n  });\n}\nbatch.failFast().then(() => console.log('All done'));","lang":"typescript","description":"Basic usage of YQueue with priority and YBatch with backpressure."},"warnings":[{"fix":"Always add .catch() to the promise returned by .run(), or use .add() with error handling.","message":"Unhandled promise rejection: tasks added via .run() that throw must be caught; otherwise the error may be unhandled and crash the process.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"If you need to limit total in-flight + pending, implement your own logic or use YBatch with maxQueueLength.","message":"onQueueSizeLessThan does not account for currently running jobs (up to concurrency). It only waits for pending queue size.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"No immediate action needed. Use { priority: number } as shown in docs.","message":"Options object for .run() and .add() currently supports only 'priority'. Future versions might add more options; always use object syntax.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Wait for .failFast() or .allSettled() to know when tasks finish.","message":"YBatch.add() returns a promise that settles when the task is added (queue size < maxQueueLength), not when the task completes.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'async':47 'backpressur':43 'batch':24,40 'best':51 'best-effort':50 'bottleneck':31 'concurr':5,16,67 'control':17 'depend':63 'effort':52 'error':21,53 'handl':22 'hook':48 'javascript':64 'lightweight':59 'limit':29 'maxqueuelength':45 'mode':41 'month':12 'node.js':10 'nodej':65 'offer':33 'oper':25 'p':28 'p-limit':27 'priorit':18 'prioriti':6 'provid':15 'queue':8,37,66 'releas':13 'runtim':62 'ship':56 'simpl':36 'stack':54 'support':46 'task':7,19 'trace':55 'type':58 'typescript':57,68 'unlik':26 'v1.0.1':11 'via':44 'yqueue':1,2,32 'zero':61","created_at":"2026-06-07T13:01:55.235132+00:00","updated_at":"2026-06-07T13:01:55.235132+00:00","problems":[{"fix":"Use `import { YQueue } from 'yqueue'` instead of `import YQueue from 'yqueue'`.","cause":"Default import instead of named import.","error":"TypeError: YQueue is not a constructor"},{"fix":"Add .catch() to the promise returned by .run() or handle errors via YBatch.failFast().","cause":".run() promise not caught or .add() with no error handling.","error":"UnhandledPromiseRejectionWarning: Error: task failed"},{"fix":"Set concurrency to an integer >= 1.","cause":"Passed invalid concurrency value (e.g., 0 or string).","error":"Error: options.concurrency must be a number >= 1"}],"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/innopals/yqueue","github":"git@github.com:innopals/yqueue","docs":null,"changelog":null,"pypi":null,"npm":"yqueue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["devops"],"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}}