Comparing version 3.5.3 to 3.6.0
# Changelog | ||
## v.3.6.0 | ||
- feat: add function to remove repeatable jobs by key. | ||
- fix: properly remove sandbox events. Fixes #1179. | ||
- fix: make progress functions in sandbox consistently return a promise. | ||
[Changes](https://github.com/OptimalBits/bull/compare/v3.5.3...v3.6.0) | ||
## v.3.5.3 | ||
@@ -4,0 +12,0 @@ |
@@ -108,4 +108,5 @@ /** | ||
}); | ||
return Promise.resolve(); | ||
}; | ||
return job; | ||
} |
@@ -9,2 +9,5 @@ 'use strict'; | ||
return childPool.retain(processFile).then(child => { | ||
let msgHandler; | ||
let exitHandler; | ||
child.send({ | ||
@@ -16,6 +19,5 @@ cmd: 'start', | ||
const done = new Promise((resolve, reject) => { | ||
function handler(msg) { | ||
msgHandler = function(msg) { | ||
switch (msg.cmd) { | ||
case 'completed': | ||
child.removeListener('message', handler); | ||
resolve(msg.value); | ||
@@ -25,3 +27,2 @@ break; | ||
case 'error': { | ||
child.removeListener('message', handler); | ||
const err = new Error(); | ||
@@ -36,11 +37,15 @@ Object.assign(err, msg.value); | ||
} | ||
} | ||
}; | ||
child.on('message', handler); | ||
child.on('exit', exitCode => { | ||
exitHandler = exitCode => { | ||
reject(new Error('Unexpected exit code: ' + exitCode)); | ||
}); | ||
}; | ||
child.on('message', msgHandler); | ||
child.on('exit', exitHandler); | ||
}); | ||
return done.finally(() => { | ||
child.removeListener('message', msgHandler); | ||
child.removeListener('exit', exitHandler); | ||
childPool.release(child); | ||
@@ -47,0 +52,0 @@ }); |
@@ -115,2 +115,30 @@ 'use strict'; | ||
Queue.prototype.removeRepeatableByKey = function(repeatJobKey) { | ||
const data = this._keyToData(repeatJobKey); | ||
const queueKey = this.keys['']; | ||
return this.isReady().then(() => { | ||
return this.client.removeRepeatable( | ||
this.keys.repeat, | ||
this.keys.delayed, | ||
data.id, | ||
repeatJobKey, | ||
queueKey | ||
); | ||
}); | ||
}; | ||
Queue.prototype._keyToData = function(key) { | ||
const data = key.split(':'); | ||
return { | ||
key: key, | ||
name: data[0], | ||
id: data[1] || null, | ||
endDate: parseInt(data[2]) || null, | ||
tz: data[3] || null, | ||
cron: data[4] | ||
}; | ||
}; | ||
Queue.prototype.getRepeatableJobs = function(start, end, asc) { | ||
@@ -126,10 +154,10 @@ const key = this.keys.repeat; | ||
for (let i = 0; i < result.length; i += 2) { | ||
const data = result[i].split(':'); | ||
const data = this._keyToData(result[i]); | ||
jobs.push({ | ||
key: result[i], | ||
name: data[0], | ||
id: data[1] || null, | ||
endDate: parseInt(data[2]) || null, | ||
tz: data[3] || null, | ||
cron: data[4], | ||
key: data.key, | ||
name: data.name, | ||
id: data.id, | ||
endDate: data.endDate, | ||
tz: data.tz, | ||
cron: data.cron, | ||
next: parseInt(result[i + 1]) | ||
@@ -136,0 +164,0 @@ }); |
{ | ||
"name": "bull", | ||
"version": "3.5.3", | ||
"version": "3.6.0", | ||
"description": "Job manager", | ||
@@ -20,3 +20,3 @@ "main": "./index.js", | ||
"dependencies": { | ||
"cron-parser": "^2.5.0", | ||
"cron-parser": "^2.7.3", | ||
"debuglog": "^1.0.0", | ||
@@ -35,3 +35,3 @@ "ioredis": "^4.5.1", | ||
"delay": "^4.1.0", | ||
"eslint": "^5.12.0", | ||
"eslint": "^5.12.1", | ||
"eslint-plugin-node": "^8.0.1", | ||
@@ -44,5 +44,5 @@ "expect.js": "^0.3.1", | ||
"mocha-lcov-reporter": "^1.3.0", | ||
"moment": "^2.23.0", | ||
"moment": "^2.24.0", | ||
"p-reflect": "^1.0.0", | ||
"prettier": "^1.15.3", | ||
"prettier": "^1.16.1", | ||
"sinon": "^7.2.3" | ||
@@ -49,0 +49,0 @@ }, |
Sorry, the diff of this file is not supported yet
Major refactor
Supply chain riskPackage has recently undergone a major refactor. It may be unstable or indicate significant internal changes. Use caution when updating to versions that include significant changes.
Found 1 instance in 1 package
405222
65
3365
2
Updatedcron-parser@^2.7.3