Socket
Socket
Sign inDemoInstall

better-queue

Package Overview
Dependencies
3
Maintainers
2
Versions
59
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 3.8.11 to 3.8.12

1

lib/queue.js

@@ -620,2 +620,3 @@ var uuid = require('uuid');

self._failedTotal++;
self._retries[taskId] = undefined
self.emit('task_failed', taskId, msg, stats);

@@ -622,0 +623,0 @@ } else {

2

package.json
{
"name": "better-queue",
"version": "3.8.11",
"version": "3.8.12",
"description": "Better Queue for NodeJS",

@@ -5,0 +5,0 @@ "main": "lib/queue.js",

@@ -84,2 +84,32 @@ var assert = require('assert');

it('should retry jobs with same id', function (done) {
const maxRetries = 3
const getJob = (id = 1) => ({ id, attempt: 0 })
const q = new Queue((job, cb) => {
job.attempt++
cb(job)
}, { maxRetries })
let job = getJob(1)
q.push(job)
.on('failed', err => {
assert.equal(err.id, job.id)
assert.equal(err.attempt, maxRetries)
job = getJob(2)
q.push(job)
.on('failed', err => {
assert.equal(err.id, job.id)
assert.equal(err.attempt,maxRetries)
job = getJob(1)
q.push(job)
.on('failed', err => {
assert.equal(err.id, job.id)
assert.equal(err.attempt, maxRetries, 'job with id 1 shall fail after maxRetries')
done()
})
})
})
})
it('should fail retry', function (done) {

@@ -86,0 +116,0 @@ var tries = 0;

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc