{"id":46382,"library":"simple-redis-safe-work-queue","title":"simple-redis-safe-work-queue","description":"A Redis-backed work queue for Node.js producers and consumers, providing safe and simple job processing. Version 3.1.1 is the latest stable release. It supports Lua scripting for atomic operations and includes features like configurable timeouts, retries, concurrency control, and watchdog timers for stalled jobs. Compared to alternatives like Bull or Kue, this library offers a minimal API with separate client and worker constructors, events for lifecycle hooks, and simple job push/fetch mechanics. It requires Redis 2.6+ and has no external dependencies beyond the redis client.","status":"active","version":"3.1.1","language":"javascript","source_language":"en","source_url":"git://github.com/pgte/simple-redis-safe-work-queue","tags":["javascript","redis","work","queue","safe","simple"],"install":[{"cmd":"npm install simple-redis-safe-work-queue","lang":"bash","label":"npm"},{"cmd":"yarn add simple-redis-safe-work-queue","lang":"bash","label":"yarn"},{"cmd":"pnpm add simple-redis-safe-work-queue","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Default import is the module itself; named export pattern is incorrect. CommonJS require works too.","wrong":"const { Queue } = require('simple-redis-safe-work-queue')","symbol":"Queue","correct":"import Queue from 'simple-redis-safe-work-queue'"},{"note":"Queue.client is a factory function, not a constructor. Do not use `new`.","wrong":"const client = new Queue.client('queue-name')","symbol":"client","correct":"const client = Queue.client('queue-name')"},{"note":"Queue.worker is a factory function. Options object is optional and can include properties like maxConcurrency, maxRetries, etc.","wrong":"const worker = new Queue.worker()","symbol":"worker","correct":"const worker = Queue.worker('queue-name', handler, options)"}],"quickstart":{"code":"import Queue from 'simple-redis-safe-work-queue';\n\n// Producer\nconst client = Queue.client('email-queue');\nclient.push({ to: 'user@example.com', subject: 'Hello', body: 'World' }, (err) => {\n  if (err) console.error('Push error:', err);\n});\n\n// Consumer\nconst worker = Queue.worker('email-queue', (job, done) => {\n  console.log('Processing job:', job);\n  // Simulate async work\n  setTimeout(() => {\n    done();\n  }, 1000);\n});\n\nworker.on('ready', () => console.log('Worker ready'));\nworker.on('error', (err) => console.error('Worker error:', err));","lang":"javascript","description":"Demonstrates creating a producer (client) and consumer (worker) for a simple Redis work queue."},"warnings":[{"fix":"Use `const client = Queue.client('name')` and `const worker = Queue.worker('name', fn)` without `new`.","message":"Version 2.x to 3.x: Queue.client and Queue.worker are now factory functions instead of constructors. Do not use `new`.","severity":"breaking","affected_versions":">=3.0.0"},{"fix":"Use `.fetch()` instead of `.listen()`.","message":"The `.listen()` method is deprecated in favor of `.fetch()`. Using `.listen()` may cause long polling behavior.","severity":"deprecated","affected_versions":">=3.0.0"},{"fix":"Set `autoListen: false` in worker options and call `.listen()` or `.fetch()` manually after setting up handlers.","message":"If `autoListen` is true (default), the worker starts listening immediately upon creation. This may cause unexpected behavior if you want to set up event handlers first.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Check for null before processing: `worker.fetch((err, job) => { if (job) { /* process job */ } });`","message":"When using `.fetch()` with `autoListen: false`, the method returns null if no messages are available. Ensure your code handles null responses correctly.","severity":"gotcha","affected_versions":">=3.0.0"},{"fix":"Use events like 'work done' on the worker to get processing completion notification.","message":"The `push()` callback is called after the job is added to Redis. It does not indicate that the job has been processed.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'2.6':84 '3.1.1':25 'altern':55 'api':65 'atom':36 'back':10 'beyond':90 'bull':57 'client':68,93 'compar':53 'concurr':45 'configur':42 'constructor':71 'consum':17 'control':46 'depend':89 'event':72 'extern':88 'featur':40 'hook':75 'includ':39 'javascript':94 'job':22,52,78 'kue':59 'latest':28 'librari':61 'lifecycl':74 'like':41,56 'lua':33 'mechan':80 'minim':64 'node.js':14 'offer':62 'oper':37 'process':23 'produc':15 'provid':18 'push/fetch':79 'queue':6,12,97 'redi':3,9,83,92,95 'redis-back':8 'releas':30 'requir':82 'retri':44 'safe':4,19,98 'script':34 'separ':67 'simpl':2,21,77,99 'simple-redis-safe-work-queu':1 'stabl':29 'stall':51 'support':32 'timeout':43 'timer':49 'version':24 'watchdog':48 'work':5,11,96 'worker':70","created_at":"2026-06-07T12:59:39.656513+00:00","updated_at":"2026-06-07T12:59:39.656513+00:00","problems":[{"fix":"Use `const client = Queue.client('name')` without `new`.","cause":"Using `new` with Queue.client in version 3.x.","error":"TypeError: Queue.client is not a constructor"},{"fix":"Start Redis server or check host/port options: `Queue.client('name', { host: 'localhost', port: 6379 })`","cause":"Redis server is not running or invalid host/port.","error":"Error: Redis connection refused"},{"fix":"Upgrade Redis to 2.6+ with scripting enabled.","cause":"Redis version is lower than 2.6 or Lua scripting is disabled.","error":"Error: ERR Error running script (call to f_...): @user_script:1: bad argument #1 to 'replicate_commands'"}],"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/pgte/simple-redis-safe-work-queue","github":"git://github.com/pgte/simple-redis-safe-work-queue","docs":null,"changelog":null,"pypi":null,"npm":"simple-redis-safe-work-queue","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"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}}