{"id":17122051,"url":"https://github.com/optimalbits/bull","last_synced_at":"2025-09-09T21:21:20.343Z","repository":{"id":9193581,"uuid":"10999165","full_name":"OptimalBits/bull","owner":"OptimalBits","description":"Premium Queue package for handling distributed jobs and messages in NodeJS.","archived":false,"fork":false,"pushed_at":"2024-12-18T20:36:35.000Z","size":4149,"stargazers_count":15913,"open_issues_count":151,"forks_count":1435,"subscribers_count":112,"default_branch":"develop","last_synced_at":"2025-04-23T18:40:57.667Z","etag":null,"topics":["job","job-queue","message","message-queue","nodejs","priority","queue","rate-limiter","scheduler"],"latest_commit_sha":null,"homepage":"","language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/OptimalBits.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":"support/logo.png","governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null}},"created_at":"2013-06-27T14:35:35.000Z","updated_at":"2025-04-23T17:54:45.000Z","dependencies_parsed_at":"2023-01-13T15:30:14.376Z","dependency_job_id":"17ac8838-ec3f-4ed4-b2e5-a397c85cbf6c","html_url":"https://github.com/OptimalBits/bull","commit_stats":{"total_commits":1746,"total_committers":249,"mean_commits":"7.0120481927710845","dds":"0.44329896907216493","last_synced_commit":"79113ac6f3b210f3a5676ecc9841b884125a38e6"},"previous_names":[],"tags_count":186,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OptimalBits%2Fbull","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OptimalBits%2Fbull/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OptimalBits%2Fbull/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/OptimalBits%2Fbull/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/OptimalBits","download_url":"https://codeload.github.com/OptimalBits/bull/tar.gz/refs/heads/develop","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":252522178,"owners_count":21761685,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["job","job-queue","message","message-queue","nodejs","priority","queue","rate-limiter","scheduler"],"created_at":"2024-10-14T18:06:20.463Z","updated_at":"2025-05-05T15:20:45.604Z","avatar_url":"https://github.com/OptimalBits.png","language":"JavaScript","readme":"\n\u003cdiv align=\"center\"\u003e\n  \u003cbr/\u003e\n  \u003cimg src=\"./support/logo@2x.png\" width=\"300\" /\u003e\n  \u003cbr/\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    The fastest, most reliable, Redis-based queue for Node. \u003cbr/\u003e\n    Carefully written for rock solid stability and atomicity.\n  \u003c/p\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    \u003ca href=\"#-sponsors-\"\u003e\u003cstrong\u003eSponsors\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#bull-features\"\u003e\u003cstrong\u003eFeatures\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#uis\"\u003e\u003cstrong\u003eUIs\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#install\"\u003e\u003cstrong\u003eInstall\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#quick-guide\"\u003e\u003cstrong\u003eQuick Guide\u003c/strong\u003e\u003c/a\u003e ·\n    \u003ca href=\"#documentation\"\u003e\u003cstrong\u003eDocumentation\u003c/strong\u003e\u003c/a\u003e\n  \u003c/p\u003e\n  \u003cp\u003eCheck the new \u003ca href=\"https://optimalbits.github.io/bull/\"\u003e\u003cstrong\u003eGuide!\u003c/strong\u003e\u003c/p\u003e\n  \u003cbr/\u003e\n  \u003cp\u003e\n    \u003ca href=\"https://gitter.im/OptimalBits/bull\"\u003e\n      \u003cimg src=\"https://badges.gitter.im/Join%20Chat.svg\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://join.slack.com/t/bullmq/shared_invite/zt-1nbtpk6mv-TItWpF9jf3k4yrCaS0PPZA\"\u003e\n      \u003cimg src=\"https://img.shields.io/badge/Slack-4A154B\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://badge.fury.io/js/bull\"\u003e\n      \u003cimg src=\"https://badge.fury.io/js/bull.svg\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"https://coveralls.io/github/OptimalBits/bull?branch=master\"\u003e\n      \u003cimg src=\"https://coveralls.io/repos/github/OptimalBits/bull/badge.svg?branch=master\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://isitmaintained.com/project/OptimalBits/bull\"\u003e\n      \u003cimg src=\"http://isitmaintained.com/badge/open/optimalbits/bull.svg\"/\u003e\n    \u003c/a\u003e\n    \u003ca href=\"http://isitmaintained.com/project/OptimalBits/bull\"\u003e\n      \u003cimg src=\"http://isitmaintained.com/badge/resolution/optimalbits/bull.svg\"/\u003e\n    \u003c/a\u003e\n        \u003ca href=\"https://twitter.com/manast\"\u003e\n      \u003cimg src=\"https://img.shields.io/twitter/follow/manast?label=Stay%20updated\u0026style=social\"/\u003e\n    \u003c/a\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n### 🚀 Sponsors 🚀\n\n\u003ctable cellspacing=\"0\" cellpadding=\"0\" border=\"0\"\u003e\n  \u003ctr\u003e\n    \u003ctd\u003e\n      \u003ca href=\"https://www.dragonflydb.io/\"\u003e\n        \u003cimg src=\"https://raw.githubusercontent.com/dragonflydb/dragonfly/main/.github/images/logo-full.svg\" width=550 alt=\"Dragonfly\" /\u003e\n      \u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd\u003e\n      Dragonfly is a new Redis™ drop-in replacement that is fully compatible with BullMQ and brings some important advantages over Redis™ such as massive\n      better performance by utilizing all CPU cores available and faster and more memory efficient data structures. Read more \u003ca href=\"https://www.dragonflydb.io/docs/integrations/bullmq\"\u003ehere\u003c/a\u003e on how to use it with BullMQ.\n    \u003c/td\u003e\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n### 📻 News and updates\n\nBull is currently in maintenance mode, we are only fixing bugs. For new features check [BullMQ](https://github.com/taskforcesh/bullmq), a modern rewritten\nimplementation in Typescript. You are still very welcome to use Bull if it suits your needs, which is a safe, battle tested library.\n\nFollow me on [Twitter](http://twitter.com/manast) for other important news and updates.\n\n### 🛠 Tutorials\n\nYou can find tutorials and news in this blog: https://blog.taskforce.sh/\n\n---\n\n### Used by\n\nBull is popular among large and small organizations, like the following ones:\n\n\u003ctable cellspacing=\"0\" cellpadding=\"0\"\u003e\n  \u003ctr\u003e\n    \u003ctd valign=\"center\"\u003e\n      \u003ca href=\"https://github.com/atlassian/github-for-jira\"\u003e\n        \u003cimg\n          src=\"https://876297641-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FevsJCF6F1tx1ScZwDQOd%2FAtlassian-horizontal-blue-rgb.webp?alt=media\u0026token=2fcd0528-e8bb-4bdd-af35-9d20e313d1a8\"\n          width=\"150\"\n          alt=\"Atlassian\"\n      /\u003e\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd valign=\"center\"\u003e\n      \u003ca href=\"https://github.com/Autodesk\"\u003e\n        \u003cimg\n          src=\"https://876297641-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FvpTe02RdOhUJBA8TdHEE%2Fautodesk-logo-white.png?alt=media\u0026token=326961b4-ea4f-4ded-89a4-e05692eec8ee\"\n          width=\"150\"\n          alt=\"Autodesk\"\n      /\u003e\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd valign=\"center\"\u003e\n      \u003ca href=\"https://github.com/common-voice/common-voice\"\u003e\n        \u003cimg\n          src=\"https://876297641-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2F4zPSrubNJKViAzUIftIy%2Fmozilla-logo-bw-rgb.png?alt=media\u0026token=9f93aae2-833f-4cc4-8df9-b7fea0ad5cb5\"\n          width=\"150\"\n          alt=\"Mozilla\"\n      /\u003e\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd valign=\"center\"\u003e\n      \u003ca href=\"https://github.com/nestjs/bull\"\u003e\n        \u003cimg\n          src=\"https://876297641-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FfAcGye182utFUtPKdLqJ%2FScreenshot%202022-02-15%20at%2011.32.39.png?alt=media\u0026token=29feb550-f0bc-467d-a290-f700701d7d15\"\n          width=\"150\"\n          alt=\"Nest\"\n      /\u003e\u003c/a\u003e\n    \u003c/td\u003e\n    \u003ctd valign=\"center\"\u003e\n      \u003ca href=\"https://github.com/salesforce/refocus\"\u003e\n        \u003cimg\n          src=\"https://876297641-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-LUuDmt_xXMfG66Rn1GA%2Fuploads%2FZNnYNuL5qJ6ZoBh7JJEW%2Fsalesforce-logo.png?alt=media\u0026token=ddcae63b-08c0-4dd4-8496-3b29a9bf977d\"\n          width=\"100\"\n          alt=\"Salesforce\"\n      /\u003e\u003c/a\u003e\n    \u003c/td\u003e\n\n  \u003c/tr\u003e\n\u003c/table\u003e\n\n---\n\n---\n\n### Official FrontEnd\n\n[\u003cimg src=\"http://taskforce.sh/assets/logo_square.png\" width=\"100\" alt=\"Taskforce.sh, Inc\" style=\"padding: 100px\"/\u003e](https://taskforce.sh)\n\nSupercharge your queues with a professional front end:\n- Get a complete overview of all your queues.\n- Inspect jobs, search, retry, or promote delayed jobs.\n- Metrics and statistics.\n- and many more features.\n\nSign up at [Taskforce.sh](https://taskforce.sh)\n\n---\n\n### Bull Features\n\n- [x] Minimal CPU usage due to a polling-free design.\n- [x] Robust design based on Redis.\n- [x] Delayed jobs.\n- [x] Schedule and repeat jobs according to a cron specification.\n- [x] Rate limiter for jobs.\n- [x] Retries.\n- [x] Priority.\n- [x] Concurrency.\n- [x] Pause/resume—globally or locally.\n- [x] Multiple job types per queue.\n- [x] Threaded (sandboxed) processing functions.\n- [x] Automatic recovery from process crashes.\n\nAnd coming up on the roadmap...\n\n- [ ] Job completion acknowledgement (you can use the message queue [pattern](https://github.com/OptimalBits/bull/blob/develop/PATTERNS.md#returning-job-completions) in the meantime).\n- [ ] Parent-child jobs relationships.\n\n---\n\n### UIs\n\nThere are a few third-party UIs that you can use for monitoring:\n\n**BullMQ**\n\n- [Taskforce](https://taskforce.sh)\n\n**Bull v3**\n\n- [Taskforce](https://taskforce.sh)\n- [bull-board](https://github.com/vcapretz/bull-board)\n- [bull-repl](https://github.com/darky/bull-repl)\n- [bull-monitor](https://github.com/s-r-x/bull-monitor)\n- [Monitoro](https://github.com/AbhilashJN/monitoro)\n\n**Bull \u003c= v2**\n\n- [Matador](https://github.com/ShaneK/Matador)\n- [react-bull](https://github.com/kfatehi/react-bull)\n- [Toureiro](https://github.com/Epharmix/Toureiro)\n\n---\n\n### Monitoring \u0026 Alerting\n\n- With Prometheus [Bull Queue Exporter](https://github.com/UpHabit/bull_exporter)\n\n---\n\n### Feature Comparison\n\nSince there are a few job queue solutions, here is a table comparing them:\n\n| Feature                   |   [BullMQ-Pro](https://bullmq.io/#bullmq-pro)    |     [BullMQ](https://bullmq.io)      |      Bull       |  Kue  | Bee      | Agenda |\n| :------------------------ | :-------------: | :-------------: | :-------------: | :---: | -------- | ------ |\n| Backend                   |      redis      |      redis      |      redis      | redis | redis    | mongo  |\n| Observables               |        ✓        |                 |                 |       |          |        |\n| Group Rate Limit          |        ✓        |                 |                 |       |          |        |\n| Group Support             |        ✓        |                 |                 |       |          |        |\n| Batches Support           |        ✓        |                 |                 |       |          |        |\n| Parent/Child Dependencies |        ✓        |        ✓        |                 |       |          |        |\n| Priorities                |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |\n| Concurrency               |        ✓        |        ✓        |        ✓        |   ✓   | ✓        | ✓      |\n| Delayed jobs              |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |\n| Global events             |        ✓        |        ✓        |        ✓        |   ✓   |          |        |\n| Rate Limiter              |        ✓        |        ✓        |        ✓        |       |          |        |\n| Pause/Resume              |        ✓        |        ✓        |        ✓        |   ✓   |          |        |\n| Sandboxed worker          |        ✓        |        ✓        |        ✓        |       |          |        |\n| Repeatable jobs           |        ✓        |        ✓        |        ✓        |       |          | ✓      |\n| Atomic ops                |        ✓        |        ✓        |        ✓        |       | ✓        |        |\n| Persistence               |        ✓        |        ✓        |        ✓        |   ✓   | ✓        | ✓      |\n| UI                        |        ✓        |        ✓        |        ✓        |   ✓   |          | ✓      |\n| Optimized for             | Jobs / Messages | Jobs / Messages | Jobs / Messages | Jobs  | Messages | Jobs   |\n\n\n### Install\n\n```bash\nnpm install bull --save\n```\nor\n\n```bash\nyarn add bull\n```\n\n_**Requirements:** Bull requires a Redis version greater than or equal to `2.8.18`._\n\n\n### Typescript Definitions\n\n```bash\nnpm install @types/bull --save-dev\n```\n```bash\nyarn add --dev @types/bull\n```\n\nDefinitions are currently maintained in the [DefinitelyTyped](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/bull) repo.\n\n\n## Contributing\n\nWe welcome all types of contributions, either code fixes, new features or doc improvements.\nCode formatting is enforced by [prettier](https://prettier.io/).\nFor commits please follow conventional [commits convention](https://www.conventionalcommits.org/en/v1.0.0-beta.2/).\nAll code must pass lint rules and test suites before it can be merged into develop.\n\n---\n\n### Quick Guide\n\n#### Basic Usage\n```js\nconst Queue = require('bull');\n\nconst videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');\nconst audioQueue = new Queue('audio transcoding', { redis: { port: 6379, host: '127.0.0.1', password: 'foobared' } }); // Specify Redis connection using object\nconst imageQueue = new Queue('image transcoding');\nconst pdfQueue = new Queue('pdf transcoding');\n\nvideoQueue.process(function (job, done) {\n\n  // job.data contains the custom data passed when the job was created\n  // job.id contains id of this job.\n\n  // transcode video asynchronously and report progress\n  job.progress(42);\n\n  // call done when finished\n  done();\n\n  // or give an error if error\n  done(new Error('error transcoding'));\n\n  // or pass it a result\n  done(null, { framerate: 29.5 /* etc... */ });\n\n  // If the job throws an unhandled exception it is also handled correctly\n  throw new Error('some unexpected error');\n});\n\naudioQueue.process(function (job, done) {\n  // transcode audio asynchronously and report progress\n  job.progress(42);\n\n  // call done when finished\n  done();\n\n  // or give an error if error\n  done(new Error('error transcoding'));\n\n  // or pass it a result\n  done(null, { samplerate: 48000 /* etc... */ });\n\n  // If the job throws an unhandled exception it is also handled correctly\n  throw new Error('some unexpected error');\n});\n\nimageQueue.process(function (job, done) {\n  // transcode image asynchronously and report progress\n  job.progress(42);\n\n  // call done when finished\n  done();\n\n  // or give an error if error\n  done(new Error('error transcoding'));\n\n  // or pass it a result\n  done(null, { width: 1280, height: 720 /* etc... */ });\n\n  // If the job throws an unhandled exception it is also handled correctly\n  throw new Error('some unexpected error');\n});\n\npdfQueue.process(function (job) {\n  // Processors can also return promises instead of using the done callback\n  return pdfAsyncProcessor();\n});\n\nvideoQueue.add({ video: 'http://example.com/video1.mov' });\naudioQueue.add({ audio: 'http://example.com/audio1.mp3' });\nimageQueue.add({ image: 'http://example.com/image1.tiff' });\n```\n\n#### Using promises\n\nAlternatively, you can return promises instead of using the `done` callback:\n\n```javascript\nvideoQueue.process(function (job) { // don't forget to remove the done callback!\n  // Simply return a promise\n  return fetchVideo(job.data.url).then(transcodeVideo);\n\n  // Handles promise rejection\n  return Promise.reject(new Error('error transcoding'));\n\n  // Passes the value the promise is resolved with to the \"completed\" event\n  return Promise.resolve({ framerate: 29.5 /* etc... */ });\n\n  // If the job throws an unhandled exception it is also handled correctly\n  throw new Error('some unexpected error');\n  // same as\n  return Promise.reject(new Error('some unexpected error'));\n});\n```\n\n#### Separate processes\n\nThe process function can also be run in a separate process. This has several advantages:\n- The process is sandboxed so if it crashes it does not affect the worker.\n- You can run blocking code without affecting the queue (jobs will not stall).\n- Much better utilization of multi-core CPUs.\n- Less connections to redis.\n\nIn order to use this feature just create a separate file with the processor:\n```js\n// processor.js\nmodule.exports = function (job) {\n  // Do some heavy work\n\n  return Promise.resolve(result);\n}\n```\n\nAnd define the processor like this:\n\n```js\n// Single process:\nqueue.process('/path/to/my/processor.js');\n\n// You can use concurrency as well:\nqueue.process(5, '/path/to/my/processor.js');\n\n// and named processors:\nqueue.process('my processor', 5, '/path/to/my/processor.js');\n```\n\n#### Repeated jobs\n\nA job can be added to a queue and processed repeatedly according to a cron specification:\n\n```js\n  paymentsQueue.process(function (job) {\n    // Check payments\n  });\n\n  // Repeat payment job once every day at 3:15 (am)\n  paymentsQueue.add(paymentsData, { repeat: { cron: '15 3 * * *' } });\n\n```\n\nAs a tip, check your expressions here to verify they are correct:\n[cron expression generator](https://crontab.cronhub.io)\n\n#### Pause / Resume\n\nA queue can be paused and resumed globally (pass `true` to pause processing for\njust this worker):\n```js\nqueue.pause().then(function () {\n  // queue is paused now\n});\n\nqueue.resume().then(function () {\n  // queue is resumed now\n})\n```\n\n#### Events\n\nA queue emits some useful events, for example...\n```js\n.on('completed', function (job, result) {\n  // Job completed with output result!\n})\n```\n\nFor more information on events, including the full list of events that are fired, check out the [Events reference](./REFERENCE.md#events)\n\n#### Queues performance\n\nQueues are cheap, so if you need many of them just create new ones with different\nnames:\n```javascript\nconst userJohn = new Queue('john');\nconst userLisa = new Queue('lisa');\n.\n.\n.\n```\n\nHowever every queue instance will require new redis connections, check how to [reuse connections](https://github.com/OptimalBits/bull/blob/master/PATTERNS.md#reusing-redis-connections) or you can also use [named processors](https://github.com/OptimalBits/bull/blob/master/REFERENCE.md#queueprocess) to achieve a similar result.\n\n#### Cluster support\n\nNOTE: From version 3.2.0 and above it is recommended to use threaded processors instead.\n\nQueues are robust and can be run in parallel in several threads or processes\nwithout any risk of hazards or queue corruption. Check this simple example\nusing cluster to parallelize jobs across processes:\n```js\nconst Queue = require('bull');\nconst cluster = require('cluster');\n\nconst numWorkers = 8;\nconst queue = new Queue('test concurrent queue');\n\nif (cluster.isMaster) {\n  for (let i = 0; i \u003c numWorkers; i++) {\n    cluster.fork();\n  }\n\n  cluster.on('online', function (worker) {\n    // Let's create a few jobs for the queue workers\n    for (let i = 0; i \u003c 500; i++) {\n      queue.add({ foo: 'bar' });\n    };\n  });\n\n  cluster.on('exit', function (worker, code, signal) {\n    console.log('worker ' + worker.process.pid + ' died');\n  });\n} else {\n  queue.process(function (job, jobDone) {\n    console.log('Job done by worker', cluster.worker.id, job.id);\n    jobDone();\n  });\n}\n```\n\n---\n\n\n### Documentation\n\nFor the full documentation, check out the reference and common patterns:\n\n- [Guide](https://optimalbits.github.io/bull/) — Your starting point for developing with Bull.\n- [Reference](./REFERENCE.md) — Reference document with all objects and methods available.\n- [Patterns](./PATTERNS.md) — a set of examples for common patterns.\n- [License](./LICENSE.md) — the Bull license—it's MIT.\n\nIf you see anything that could use more docs, please submit a pull request!\n\n\n\n---\n\n### Important Notes\n\nThe queue aims for an \"at least once\" working strategy. This means that in some situations, a job\ncould be processed more than once. This mostly happens when a worker fails to keep a lock\nfor a given job during the total duration of the processing.\n\nWhen a worker is processing a job it will keep the job \"locked\" so other workers can't process it.\n\nIt's important to understand how locking works to prevent your jobs from losing their lock - becoming _stalled_ -\nand being restarted as a result. Locking is implemented internally by creating a lock for `lockDuration` on interval\n`lockRenewTime` (which is usually half `lockDuration`). If `lockDuration` elapses before the lock can be renewed,\nthe job will be considered stalled and is automatically restarted; it will be __double processed__. This can happen when:\n1. The Node process running your job processor unexpectedly terminates.\n2. Your job processor was too CPU-intensive and stalled the Node event loop, and as a result, Bull couldn't renew the job lock (see [#488](https://github.com/OptimalBits/bull/issues/488) for how we might better detect this). You can fix this by breaking your job processor into smaller parts so that no single part can block the Node event loop. Alternatively, you can pass a larger value for the `lockDuration` setting (with the tradeoff being that it will take longer to recognize a real stalled job).\n\nAs such, you should always listen for the `stalled` event and log this to your error monitoring system, as this means your jobs are likely getting double-processed.\n\nAs a safeguard so problematic jobs won't get restarted indefinitely (e.g. if the job processor always crashes its Node process), jobs will be recovered from a stalled state a maximum of `maxStalledCount` times (default: `1`).\n","funding_links":[],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimalbits%2Fbull","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Foptimalbits%2Fbull","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Foptimalbits%2Fbull/lists"}