Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

bull

Package Overview
Dependencies
Maintainers
1
Versions
198
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

bull - npm Package Compare versions

Comparing version 0.1.8 to 0.1.9

a.js

14

CHANGELOG.md

@@ -0,1 +1,15 @@

v0.1.9
======
- [Improvement] Faster job removal. (manast)
v0.1.8
======
- [Improvement] Better promisification of redis methods. (manast)
v0.1.7
======
- [Feature] Added a convenience method for getting a job. (loginx)
- [Fix] Only set a redis db from options if defined. (jboga)
- [Fix] Fixed issue #52. (manast)
v0.1.6

@@ -2,0 +16,0 @@ ======

42

lib/job.js
"use strict";
var redis = require('redis');
var Promise = require('bluebird');
var _ = require('lodash');

@@ -120,14 +121,37 @@ /**

/**
Removes a job from the queue and from all the lists where it may be.
Removes a job from the queue and from all the lists where it may be stored.
*/
Job.prototype.remove = function(){
var queue = this.queue;
return queue.multi()
.lrem(queue.toKey('active'), 0, this.jobId)
.lrem(queue.toKey('wait'), 0, this.jobId)
.lrem(queue.toKey('paused'), 0, this.jobId)
.srem(queue.toKey('completed'), this.jobId)
.srem(queue.toKey('failed'), this.jobId)
.del(queue.toKey(this.jobId))
.execAsync();
var script = [
'if (redis.call("SISMEMBER", KEYS[4], ARGV[1]) == 0) and (redis.call("SISMEMBER", KEYS[5], ARGV[1]) == 0) then',
' redis.call("LREM", KEYS[1], 0, ARGV[1])',
' redis.call("LREM", KEYS[2], 0, ARGV[1])',
' redis.call("LREM", KEYS[3], 0, ARGV[1])',
'end',
'redis.call("SREM", KEYS[4], ARGV[1])',
'redis.call("SREM", KEYS[5], ARGV[1])',
'redis.call("DEL", KEYS[6])'].join('\n');
var keys = _.map([
'active',
'wait',
'paused',
'completed',
'failed',
this.jobId], function(name){
return queue.toKey(name);
});
return this.queue.client.evalAsync(
script,
keys.length,
keys[0],
keys[1],
keys[2],
keys[3],
keys[4],
keys[5],
this.jobId);
}

@@ -134,0 +158,0 @@

{
"name": "bull",
"version": "0.1.8",
"version": "0.1.9",
"description": "Job manager",

@@ -5,0 +5,0 @@ "main": "index.js",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc