Diego Kuperman > Resque > Resque::Failures

Download:
Resque-0.22.tar.gz

Dependencies

Annotate this POD

Website

View/Report Bugs
Module Version: 0.22   Source  

NAME ^

Resque::Failures - Class for managing Resque failures

VERSION ^

version 0.22

ATTRIBUTES ^

resque

Accessor to the Resque object.

failure_class

Name of a class consuming the role 'Resque::Failure'. By default: Resque::Failure::Redis

METHODS ^

throw

create() a failure on the failure_class() and save() it.

create

Create a new failure on the failure_class() backend.

count

How many failures was in all the resque system.

all

Return a range of failures in the same way Resque::peek() does for jobs.

clear

Remove all failures.

requeue

Requeue by index number.

Failure will be updated to note retried date.

remove

Remove failure by index number in failures queue.

Please note that, when you remove some index, all sucesive ones will move left, so index will decrese one. If you want to remove several ones start removing from the rightmost one.

mass_remove

Remove and optionally requeue all or matching failed jobs. Errors that happen after this method is fired will remind untouched.

Filters, if present, are useful to select failed jobs and should be regexes or strings that will be matched against any of the following failed job field:

    queue: the queue where job had failed
    class: the job class
    error: the error string
    args:  a JSON representation of the job arguments

By default, all matching jobs will be deleted but the ones that doesn't match will be placed back at the end of the failed jobs.

The behavior can be modified with the following options:

    requeue: requeue matching jobs after being removed
    queue:   force requeued jobs to be placed on this queue

Example

    # Remove and requeue all failed jobs from queue 'test_queue' of class My::Job::Class
    $resque->failures->mass_remove(
        queue   => 'test_queue',
        class   => qr/^My::Job::Class$/,
        requeue => 1
    );

AUTHOR ^

Diego Kuperman <diego@freekeylabs.com>

COPYRIGHT AND LICENSE ^

This software is copyright (c) 2015 by Diego Kuperman.

This is free software; you can redistribute it and/or modify it under the same terms as the Perl 5 programming language system itself.

syntax highlighting: