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 4.1.0 to 4.1.1

7

CHANGELOG.md

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

## [4.1.1](https://github.com/OptimalBits/bull/compare/v4.1.0...v4.1.1) (2021-11-16)
### Bug Fixes
* **emit:** protect emit calls fixes [#2213](https://github.com/OptimalBits/bull/issues/2213) ([4978a2b](https://github.com/OptimalBits/bull/commit/4978a2b40ee840ba91e0939e86e1e3b15e8b16e9))
# [4.1.0](https://github.com/OptimalBits/bull/compare/v4.0.0...v4.1.0) (2021-10-31)

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

13

lib/commands/index.js

@@ -15,14 +15,7 @@ /**

const fs = require('fs');
const fsAsync = require('fs').promises;
const path = require('path');
const promisify = require('util.promisify'); //TODO in node >= 8 could be removed
const utils = require('../utils');
//TODO node >= 10 could be used require('fs').promises()
const _fs = {
readdirAsync: promisify(fs.readdir),
readFileAsync: promisify(fs.readFile)
};
module.exports = (function() {

@@ -42,3 +35,3 @@ let scripts;

async function loadScripts(dir) {
const scriptsDir = await _fs.readdirAsync(dir);
const scriptsDir = await fsAsync.readdir(dir);
const luaFiles = scriptsDir.filter(file => path.extname(file) === '.lua');

@@ -54,3 +47,3 @@ if (luaFiles.length === 0) {

luaFiles.map(async file => {
const lua = await _fs.readFileAsync(path.join(dir, file));
const lua = await fsAsync.readFile(path.join(dir, file));
const longName = path.basename(file, '.lua');

@@ -57,0 +50,0 @@

@@ -12,7 +12,4 @@ /**

//TODO remove for node >= 10
require('promise.prototype.finally').shim();
const { promisify } = require('util');
const promisify = require('util.promisify');
// same as process.send but waits until the send is complete

@@ -19,0 +16,0 @@

'use strict';
//TODO remove for node >= 10
require('promise.prototype.finally').shim();
module.exports = function(processFile, childPool) {

@@ -7,0 +4,0 @@ return function process(job) {

'use strict';
//TODO remove for node >= 10
require('promise.prototype.finally').shim();
const redis = require('ioredis');

@@ -21,3 +18,3 @@ const EventEmitter = require('events');

const TimerManager = require('./timer-manager');
const promisify = require('util.promisify');
const { promisify } = require('util');
const pTimeout = require('p-timeout');

@@ -402,15 +399,15 @@ const semver = require('semver');

case activeKey:
this.emit('global:active', message, 'waiting');
utils.emitSafe(this, 'global:active', message, 'waiting');
break;
case waitingKey:
if (this.token === token) {
this.emit('waiting', message, null);
utils.emitSafe(this, 'waiting', message, null);
}
token && this.emit('global:waiting', message, null);
token && utils.emitSafe(this, 'global:waiting', message, null);
break;
case stalledKey:
if (this.token === token) {
this.emit('stalled', message);
utils.emitSafe(this, 'stalled', message);
}
this.emit('global:stalled', message);
utils.emitSafe(this, 'global:stalled', message);
break;

@@ -427,3 +424,3 @@ }

const { progress, jobId } = JSON.parse(message);
this.emit('global:progress', jobId, progress);
utils.emitSafe(this, 'global:progress', jobId, progress);
} catch (err) {

@@ -434,3 +431,3 @@ // If we fail we should try to parse the data using the deprecated method

const progress = message.substring(commaPos + 1);
this.emit('global:progress', jobId, JSON.parse(progress));
utils.emitSafe(this, 'global:progress', jobId, JSON.parse(progress));
}

@@ -453,7 +450,13 @@ break;

case resumedKey:
this.emit('global:' + message);
utils.emitSafe(this, 'global:' + message);
break;
case completedKey: {
const data = JSON.parse(message);
this.emit('global:completed', data.jobId, data.val, 'active');
utils.emitSafe(
this,
'global:completed',
data.jobId,
data.val,
'active'
);
break;

@@ -463,7 +466,7 @@ }

const data = JSON.parse(message);
this.emit('global:failed', data.jobId, data.val, 'active');
utils.emitSafe(this, 'global:failed', data.jobId, data.val, 'active');
break;
}
case drainedKey:
this.emit('global:drained');
utils.emitSafe(this, 'global:drained');
break;

@@ -512,3 +515,3 @@ }

.then(() => {
this.emit('registered:' + eventName);
utils.emitSafe(this, 'registered:' + eventName);
});

@@ -598,3 +601,3 @@ } else {

this.closed = true;
this.emit('close');
utils.emitSafe(this, 'close');
}));

@@ -647,3 +650,3 @@ };

return this.run(concurrency, name).catch(err => {
this.emit('error', err, 'error running queue');
utils.emitSafe(this, 'error', err, 'error running queue');
throw err;

@@ -848,3 +851,3 @@ });

.then(() => {
return this.emit('paused');
return utils.emitSafe(this, 'paused');
});

@@ -865,3 +868,3 @@ };

.then(() => {
this.emit('resumed');
utils.emitSafe(this, 'resumed');
});

@@ -956,3 +959,3 @@ };

.catch(err => {
this.emit('error', err, 'Error updating the delay timer');
utils.emitSafe(this, 'error', err, 'Error updating the delay timer');
if (this.delayTimer) {

@@ -984,3 +987,4 @@ clearTimeout(this.delayTimer);

return this.getJobFromId(jobId).then(job => {
this.emit(
utils.emitSafe(
this,
'failed',

@@ -998,3 +1002,3 @@ job,

if (job !== null) {
this.emit('stalled', job);
utils.emitSafe(this, 'stalled', job);
}

@@ -1007,3 +1011,8 @@ return null;

.catch(err => {
this.emit('error', err, 'Failed to handle unlocked job in active');
utils.emitSafe(
this,
'error',
err,
'Failed to handle unlocked job in active'
);
});

@@ -1047,3 +1056,3 @@ };

if (!(this.closing && err.message === 'Connection is closed.')) {
this.emit('error', err, 'Error processing job');
utils.emitSafe(this, 'error', err, 'Error processing job');

@@ -1062,3 +1071,3 @@ //

.catch(err => {
this.emit('error', err, 'Error processing job');
utils.emitSafe(this, 'error', err, 'Error processing job');
});

@@ -1099,3 +1108,3 @@ } else {

.catch(err => {
this.emit('lock-extension-failed', job, err);
utils.emitSafe(this, 'lock-extension-failed', job, err);
});

@@ -1115,3 +1124,3 @@ }

return job.moveToCompleted(result, undefined, notFetch).then(jobData => {
this.emit('completed', job, result, 'active');
utils.emitSafe(this, 'completed', job, result, 'active');
return jobData ? this.nextJobFromJobData(jobData[0], jobData[1]) : null;

@@ -1125,3 +1134,3 @@ });

return job.moveToFailed(err).then(jobData => {
this.emit('failed', job, error, 'active');
utils.emitSafe(this, 'failed', job, error, 'active');
return jobData ? this.nextJobFromJobData(jobData[0], jobData[1]) : null;

@@ -1146,3 +1155,3 @@ });

// Local event with jobPromise so that we can cancel job.
this.emit('active', job, jobPromise, 'waiting');
utils.emitSafe(this, 'active', job, jobPromise, 'waiting');

@@ -1218,3 +1227,3 @@ return jobPromise

this.drained = true;
this.emit('drained');
utils.emitSafe(this, 'drained');
return null;

@@ -1263,7 +1272,7 @@ }

.then(jobs => {
this.emit('cleaned', jobs, type);
utils.emitSafe(this, 'cleaned', jobs, type);
return jobs;
})
.catch(err => {
this.emit('error', err);
utils.emitSafe(this, 'error', err);
throw err;

@@ -1270,0 +1279,0 @@ });

@@ -48,1 +48,13 @@ 'use strict';

module.exports.isRedisReady = isRedisReady;
module.exports.emitSafe = function(emitter, event, ...args) {
try {
return emitter.emit(event, ...args);
} catch (err) {
try {
return emitter.emit('error', err);
} catch (err) {
// We give up if the error event also throws an exception.
console.error(err);
}
}
};
{
"name": "bull",
"version": "4.1.0",
"version": "4.1.1",
"description": "Job manager",
"engines": {
"node": ">=10"
"node": ">=10.1"
},

@@ -29,5 +29,3 @@ "main": "./index.js",

"p-timeout": "^3.2.0",
"promise.prototype.finally": "^3.1.2",
"semver": "^7.3.2",
"util.promisify": "^1.0.1",
"uuid": "^8.3.0"

@@ -34,0 +32,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