Skip to content

Releases: actionhero/node-resque

v5.3.0: Worker Cleanup by Scheduler

26 Apr 03:52
Compare
Choose a tag to compare

Worker Cleanup by Scheduler

  • remove worker#workerCleanup
  • scheduler cleans up workers which stop pinging.

By default, the scheduler will check for workers which haven't pinged redis in 60 minutes. If this happens, we will assume the process crashed, and remove it from redis. If this worker was working on a job, we will place it in the failed queue for later inspection. Every worker has a timer running in which it then updates a key in redis every timeout (default: 5 seconds). If your job is slow, but async, there should be no problem. However, if your job consumes 100% of the CPU of the process, this timer might not fire.

To modify the 60 minute check, change stuckWorkerTimeout when configuring your scheudler, ie:

const scheduler = new NodeResque.Scheduler({
  stuckWorkerTimeout: (1000 * 60 * 60) // 1 hour, in ms
  connection: connectionDetails
})

Set your scheduler's stuckWorkerTimeout = false to disable this behavior.

const scheduler = new NodeResque.Scheduler({
  stuckWorkerTimeout: false // will not fail jobs which haven't pinged redis
  connection: connectionDetails
})

Jest

We now test this project with Jest, dropping mocha and should

Test Cleanup

21 Feb 04:37
Compare
Choose a tag to compare

Ensure that connections are properly closed in tests (and other node.js processes)

  • Properly close all connections in test suite; prevent node app from shutdown 'hang'.
  • Removed toDisconnectProcessors as a multiworker option, because it actually wasn't doing anything
    (#235)

Misc

  • update dependencies

v5.1.0: Locks and BusyBox

27 Dec 20:10
Compare
Choose a tag to compare

Clear locks from QueueLock when a job is popped rather than successful.

Support for BusyBox Linux

Changes the way we detect running PIDs on Linux/Unix/OSX to be more compatible.

Fix Typos in Readme

v4.0.9

03 Oct 19:11
Compare
Choose a tag to compare

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

02 Oct 22:39
Compare
Choose a tag to compare

Fixes a bug which prevented plugins defined by a function from being run.

v5.0.1: faster check for de-duplication in delayed queues

29 Sep 20:16
Compare
Choose a tag to compare

Check if job already exists in queue

  • Instead of getting the full set (smembers), and iterating through it, just use sismember.
  • by @SGKumar via #215

misc

  • clarify methods in readme

v5.0.0: Async/Await

21 Sep 22:05
Compare
Choose a tag to compare

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 an Error object.
    • You can use try/catch to decide what to do with errors in your project
    • for example:
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.

21 Aug 22:46
Compare
Choose a tag to compare

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

08 Jun 16:58
Compare
Choose a tag to compare

In some cases stop callback for multiWorker called before all workers stopped.
It's happened through calling self.workers.pop() in checkWorkers method, and check self.workers.length === 0 in stopWait.

v4.0.6

18 May 17:18
Compare
Choose a tag to compare
  • Project now includes a linter as part of the test suite via standardjs.com (#184)
  • Support for string'd errors from a worker (#188)
  • Update ioredis to v3.x.x (#204)