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 3.23.0 to 3.23.1

7

CHANGELOG.md

@@ -0,1 +1,8 @@

## [3.23.1](https://github.com/OptimalBits/bull/compare/v3.23.0...v3.23.1) (2021-07-15)
### Bug Fixes
* wait in queue to be ready in getNextJob fixes [#1852](https://github.com/OptimalBits/bull/issues/1852) ([4e224e5](https://github.com/OptimalBits/bull/commit/4e224e5533f729b9781b1db81e1875b1bd50afb0))
# [3.23.0](https://github.com/OptimalBits/bull/compare/v3.22.12...v3.23.0) (2021-07-13)

@@ -2,0 +9,0 @@

3

lib/process/sandbox.js

@@ -39,5 +39,2 @@ 'use strict';

break;
case 'update':
job.update(msg.value);
break;
}

@@ -44,0 +41,0 @@ };

@@ -1132,3 +1132,3 @@ 'use strict';

*/
Queue.prototype.getNextJob = function() {
Queue.prototype.getNextJob = async function() {
if (this.closing) {

@@ -1142,17 +1142,20 @@ return Promise.resolve();

//
return this.bclient
.brpoplpush(this.keys.wait, this.keys.active, this.settings.drainDelay)
.then(
jobId => {
if (jobId) {
return this.moveToActive(jobId);
}
},
err => {
// Swallow error if locally paused since we did force a disconnection
if (!(this.paused && err.message === 'Connection is closed.')) {
throw err;
}
try {
const jobId = await this.bclient.brpoplpush(
this.keys.wait,
this.keys.active,
this.settings.drainDelay
);
if (jobId) {
return this.moveToActive(jobId);
}
} catch (err) {
err => {
// Swallow error if locally paused since we did force a disconnection
if (!(this.paused && err.message === 'Connection is closed.')) {
throw err;
}
);
};
}
} else {

@@ -1163,3 +1166,6 @@ return this.moveToActive();

Queue.prototype.moveToActive = function(jobId) {
Queue.prototype.moveToActive = async function(jobId) {
// For manual retrieving jobs we need to wait for the queue to be ready.
await this.isReady();
return scripts.moveToActive(this, jobId).then(([jobData, jobId]) => {

@@ -1166,0 +1172,0 @@ return this.nextJobFromJobData(jobData, jobId);

{
"name": "bull",
"version": "3.23.0",
"version": "3.23.1",
"description": "Job manager",

@@ -5,0 +5,0 @@ "engines": {

@@ -45,7 +45,9 @@

</p>
<p>
<em>Follow <a href="http://twitter.com/manast">@manast</a> for *important* Bull/BullMQ news and updates!</em>
</p>
</div>
### 📻 News and updates
Follow me on [Twitter](http://twitter.com/manast) for important news and updates.
### 🛠 Tutorials

@@ -123,2 +125,3 @@

- [bull-repl](https://github.com/darky/bull-repl)
- [bull-monitor](https://github.com/s-r-x/bull-monitor)

@@ -199,10 +202,10 @@ **Bull <= v2**

```js
var Queue = require('bull');
const Queue = require('bull');
var videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');
var audioQueue = new Queue('audio transcoding', {redis: {port: 6379, host: '127.0.0.1', password: 'foobared'}}); // Specify Redis connection using object
var imageQueue = new Queue('image transcoding');
var pdfQueue = new Queue('pdf transcoding');
const videoQueue = new Queue('video transcoding', 'redis://127.0.0.1:6379');
const audioQueue = new Queue('audio transcoding', { redis: { port: 6379, host: '127.0.0.1', password: 'foobared' } }); // Specify Redis connection using object
const imageQueue = new Queue('image transcoding');
const pdfQueue = new Queue('pdf transcoding');
videoQueue.process(function(job, done){
videoQueue.process(function (job, done) {

@@ -228,3 +231,3 @@ // job.data contains the custom data passed when the job was created

audioQueue.process(function(job, done){
audioQueue.process(function (job, done) {
// transcode audio asynchronously and report progress

@@ -246,3 +249,3 @@ job.progress(42);

imageQueue.process(function(job, done){
imageQueue.process(function (job, done) {
// transcode image asynchronously and report progress

@@ -264,3 +267,3 @@ job.progress(42);

pdfQueue.process(function(job){
pdfQueue.process(function (job) {
// Processors can also return promises instead of using the done callback

@@ -270,5 +273,5 @@ return pdfAsyncProcessor();

videoQueue.add({video: 'http://example.com/video1.mov'});
audioQueue.add({audio: 'http://example.com/audio1.mp3'});
imageQueue.add({image: 'http://example.com/image1.tiff'});
videoQueue.add({ video: 'http://example.com/video1.mov' });
audioQueue.add({ audio: 'http://example.com/audio1.mp3' });
imageQueue.add({ image: 'http://example.com/image1.tiff' });
```

@@ -281,3 +284,3 @@

```javascript
videoQueue.process(function(job){ // don't forget to remove the done callback!
videoQueue.process(function (job) { // don't forget to remove the done callback!
// Simply return a promise

@@ -310,3 +313,3 @@ return fetchVideo(job.data.url).then(transcodeVideo);

// processor.js
module.exports = function(job){
module.exports = function (job) {
// Do some heavy work

@@ -335,4 +338,4 @@

```
paymentsQueue.process(function(job){
```js
paymentsQueue.process(function (job) {
// Check payments

@@ -342,3 +345,3 @@ });

// Repeat payment job once every day at 3:15 (am)
paymentsQueue.add(paymentsData, {repeat: {cron: '15 3 * * *'}});
paymentsQueue.add(paymentsData, { repeat: { cron: '15 3 * * *' } });

@@ -355,7 +358,7 @@ ```

```js
queue.pause().then(function(){
queue.pause().then(function () {
// queue is paused now
});
queue.resume().then(function(){
queue.resume().then(function () {
// queue is resumed now

@@ -369,3 +372,3 @@ })

```js
.on('completed', function(job, result){
.on('completed', function (job, result) {
// Job completed with output result!

@@ -382,4 +385,4 @@ })

```javascript
var userJohn = new Queue('john');
var userLisa = new Queue('lisa');
const userJohn = new Queue('john');
const userLisa = new Queue('lisa');
.

@@ -400,27 +403,26 @@ .

```js
var
Queue = require('bull'),
cluster = require('cluster');
const Queue = require('bull');
const cluster = require('cluster');
var numWorkers = 8;
var queue = new Queue("test concurrent queue");
const numWorkers = 8;
const queue = new Queue('test concurrent queue');
if(cluster.isMaster){
for (var i = 0; i < numWorkers; i++) {
if (cluster.isMaster) {
for (let i = 0; i < numWorkers; i++) {
cluster.fork();
}
cluster.on('online', function(worker) {
// Lets create a few jobs for the queue workers
for(var i=0; i<500; i++){
queue.add({foo: 'bar'});
cluster.on('online', function (worker) {
// Let's create a few jobs for the queue workers
for (let i = 0; i < 500; i++) {
queue.add({ foo: 'bar' });
};
});
cluster.on('exit', function(worker, code, signal) {
cluster.on('exit', function (worker, code, signal) {
console.log('worker ' + worker.process.pid + ' died');
});
}else{
queue.process(function(job, jobDone){
console.log("Job done by worker", cluster.worker.id, job.id);
} else {
queue.process(function (job, jobDone) {
console.log('Job done by worker', cluster.worker.id, job.id);
jobDone();

@@ -427,0 +429,0 @@ });

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