Releases: actionhero/node-resque
Releases · actionhero/node-resque
v5.1.0: Locks and BusyBox
v4.0.9
The changes from https://github.com/taskrabbit/node-resque/releases/tag/v5.0.2 are backported to the v4 branch
v5.0.2: PluginRunner Fix
Fixes a bug which prevented plugins defined by a function from being run.
- via #216 by @arunsivasankaran
v5.0.1: faster check for de-duplication in delayed queues
v5.0.0: Async/Await
Version 5.0 rewrites node-resque
to use Async/Await syntax rather than callbacks.
Check out the examples & README for more information on the updated APIs.
Node.js version v8.0.0 and above is now required to run this project.
Breaking Changes
- Every callback-based method API in the package has changed to become an async method.
- Errors now
throw
rather than return anError
object. - You can use try/catch to decide what to do with errors in your project
- for example:
- Errors now
try {
const queue = new NodeResque.Queue({connection: connectionDetails}, jobs)
queue.on('error', function (error) { throw error })
await queue.connect()
} catch (error) {
console.error(`Queue Connection Error: ${error}`)
}
try {
await queue.enqueue('math', 'add', [1, 2])
await queue.enqueue('math', 'add', [1, 2])
await queue.enqueue('math', 'add', [2, 3])
await queue.enqueueIn(3000, 'math', 'subtract', [2, 1])
} catch (error) {
console.error(`Enqueue Error: ${error}`)
}
- Jobs' perform methods should now be async methods that return a response value, for example:
const jobs = {
'Sleep Add': {
plugins: ['JobLock'],
pluginOptions: {
JobLock: {}
},
perform: async (a, b) => {
let answer = a + b
await new Promise((resolve) => { setTimeout(resolve, 1000) })
return answer
}
}
}
- Plugins now inherit from
NodeResque.Plugin
, for example:
const NodeResque = require('node-resque')
class MyPlugin extends NodeResque.Plugin {
beforeEnqueue () {
// console.log("** beforeEnqueue")
return true // should the job be enqueued?
}
afterEnqueue () {
// console.log("** afterEnqueue")
}
beforePerform () {
// console.log("** beforePerform")
return true // should the job be run?
}
afterPerform () {
// console.log("** afterPerform")
}
}
- All classes now follow proper convention of having capitol letter names, ie
NodeResque.Plugin
- Plugin lifecycles are now camel case:
beforeEnqueue
,afterEnqueue
,beforePerform
,afterPerform
- Plugin lifecycle methods are now async methods, with no callback (per the above)
v4.0.8: Ensure that toRun is passed to enqueue even with an error.
If you are enqueuing a job which fails with an error, we weren't properly returning toRun
(which would be false
) as well. We are now!
v4.0.7: Fix call callback for stopMultiWorker before stop all workers
v4.0.6
v4.0.5 Retry keys
v4.0.4: Bugfix
- fix bug which might cause multiWorker to always work less than minTaskProcessors
- by @evantahler via 67f0a70