Resque::Failures - Class for managing Resque failures
Accessor to the Resque object.
Name of a class consuming the role 'Resque::Failure'. By default: Resque::Failure::Redis
create() a failure on the failure_class() and save() it.
$failures->throw( %job_description_hash );
See Resque code for a usage example.
Create a new failure on the failure_class() backend.
$failures->create( ... );
How many failures are in the resque system.
my $count = $failures->count();
Return a range of failures (or an arrayref in scalar context) in the same way Resque::peek() does for jobs.
my @failures = $failures->all('my_queue', $opt_start, $opt_count);
Remove all failures.
Requeue by index number.
Failure will be updated to note retried date.
$failures->requeue( $index );
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.
$failures->remove( $index );
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. requeue_to: Requeued jobs will be placed on this queue instead of the original one. This option implies requeue.
# 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 );
Diego Kuperman <firstname.lastname@example.org>
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.