{"id":45786,"library":"plain-queue","title":"plain-queue","description":"A lightweight queue library for Node.js that manages asynchronous task execution with configurable per-task timeouts and garbage collection of completed tasks. Version 4.0.0 requires Node.js 4+ and ships TypeScript types. Unlike many job queues, plain-queue is in-process, single-threaded, and has no persistence or external dependencies, making it ideal for simple sequential task orchestration. The library supports both promise-returning and synchronous functions, and provides timeout errors when a task exceeds the specified limit. Release cadence is low; the API has been stable since v1.0.2.","status":"active","version":"4.0.0","language":"javascript","source_language":"en","source_url":"https://github.com/mvcbox/node-plain-queue","tags":["javascript","Queue","typescript"],"install":[{"cmd":"npm install plain-queue","lang":"bash","label":"npm"},{"cmd":"yarn add plain-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add plain-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Queue is a named export, not default. In CommonJS use destructuring: const { Queue } = require('plain-queue').","wrong":"const Queue = require('plain-queue')","symbol":"Queue","correct":"import { Queue } from 'plain-queue'"},{"note":"TimeoutError is also a named export. Available for checking task timeout errors.","wrong":"","symbol":"TimeoutError","correct":"import { TimeoutError } from 'plain-queue'"},{"note":"TypeScript types are available as named exports; no separate typings package needed.","wrong":"","symbol":"types","correct":"import type { QueueOptions, TaskOptions } from 'plain-queue'"}],"quickstart":{"code":"const { Queue } = require('plain-queue');\n\nconst queue = new Queue({ taskTimeout: 5000, gcThreshold: 300 });\n\nqueue.addTask(async () => {\n  const result = await someAsyncWork();\n  return result;\n}).then(console.log).catch(console.error);\n\nfunction someAsyncWork() {\n  return Promise.resolve('Task done');\n}","lang":"javascript","description":"Creates a queue with a 5-second global timeout and 300-task GC threshold, then adds an async task and logs its result."},"warnings":[{"fix":"Ensure Node.js >= 4.0.0, or use plain-queue@3.x for older Node.","message":"Version 4.0.0 drops support for Node.js < 4.0.0. Upgrade Node or pin to older version.","severity":"breaking","affected_versions":">=4.0.0"},{"fix":"Set both global and per-task timeouts explicitly if needed.","message":"The Queue constructor's 'taskTimeout' option only applies per-task if no 'timeout' is specified in addTask. Per-task timeout overrides the global one.","severity":"gotcha","affected_versions":"all"},{"fix":"Always return a promise for async tasks.","message":"If the task function does not return a promise, it is considered completed immediately. This may cause unexpected behavior if the function starts an async operation without returning a promise.","severity":"gotcha","affected_versions":"all"},{"fix":"No action required.","message":"There is no active deprecation in the library, but the API has been stable for years; check docs for any removal of older methods.","severity":"deprecated","affected_versions":">=4.0.0"}],"env_vars":null,"search_vec":"'4':31 '4.0.0':28 'api':91 'asynchron':12 'cadenc':87 'collect':23 'complet':25 'configur':16 'depend':56 'error':78 'exceed':82 'execut':14 'extern':55 'function':74 'garbag':22 'ideal':59 'in-process':44 'javascript':97 'job':38 'librari':7,66 'lightweight':5 'limit':85 'low':89 'make':57 'manag':11 'mani':37 'node.js':9,30 'orchestr':64 'per':18 'per-task':17 'persist':53 'plain':2,41 'plain-queu':1,40 'process':46 'promis':70 'promise-return':69 'provid':76 'queue':3,6,39,42,98 'releas':86 'requir':29 'return':71 'sequenti':62 'ship':33 'simpl':61 'sinc':95 'singl':48 'single-thread':47 'specifi':84 'stabl':94 'support':67 'synchron':73 'task':13,19,26,63,81 'thread':49 'timeout':20,77 'type':35 'typescript':34,99 'unlik':36 'v1.0.2':96 'version':27","created_at":"2026-06-07T12:56:43.035032+00:00","updated_at":"2026-06-07T12:56:43.035032+00:00","problems":[{"fix":"Use destructuring: const { Queue } = require('plain-queue');","cause":"Trying to instantiate Queue as default import in CommonJS: const Queue = require('plain-queue'); new Queue();","error":"TypeError: require(...) is not a constructor"},{"fix":"Increase timeout in queue options or per-task options, or reduce task execution time.","cause":"A task exceeded the configured timeout (default 5000ms).","error":"Error: Task timeout [5000ms]"},{"fix":"Run npm install plain-queue and check import: import { Queue } from 'plain-queue';","cause":"Package not installed or import path misspelled.","error":"Module not found: Error: Can't resolve 'plain-queue'"}],"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/mvcbox/node-plain-queue#readme","github":"https://github.com/mvcbox/node-plain-queue","docs":null,"changelog":null,"pypi":null,"npm":"plain-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["storage"],"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}}