Skip to content

failed queue managment#74

Merged
evantahler merged 4 commits intomasterfrom
failure_helpers
Apr 26, 2015
Merged

failed queue managment#74
evantahler merged 4 commits intomasterfrom
failure_helpers

Conversation

@evantahler
Copy link
Member

Failed Job Managment

From time to time, your jobs/workers may fail. Resque workers will move failed jobs to a special failed queue which will store the original arguments of your job, the failing stack trace, and additional medatadata.

You can work with these failed jobs with the following methods:

  • queue.failedCount = function(callback)
    • callback(error, failedCount)
    • failedCount is the number of jobs in the failed queue
  • queue.failed = function(start, stop, callback)
    • callback(error, failedJobs)
    • failedJobs is an array listing the data of the failed jobs. Each element looks like:
{ worker: 'busted-worker-3',
  queue: 'busted-queue',
  payload: { class: 'busted_job', queue: 'busted-queue', args: [ 1, 2, 3 ] },
  exception: 'ERROR_NAME',
  error: 'I broke',
  failed_at: 'Sun Apr 26 2015 14:00:44 GMT+0100 (BST)' }
  • queue.removeFailed = function(failedJob, callback)
    • callback(error)
    • the input failedJob is an expanded node object representing the failed job, retrieved via queue.failed
  • queue.retryAndRemoveFailed = function(failedJob, callback)
    • callback(error)
    • the input failedJob is an expanded node object representing the failed job, retrieved via queue.failed
    • this method will instantly re-enqueue a failed job back to its original queue, and delete the failed entry for that job

evantahler added a commit that referenced this pull request Apr 26, 2015
@evantahler evantahler merged commit eb1a11a into master Apr 26, 2015
@evantahler evantahler deleted the failure_helpers branch April 26, 2015 13:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant