Subject: | using $task->fail("reason goes here") in Gearman::Taskset |
Calling $task->fail with no arguments leads to undef being passed to
the on_fail handler.
Subject: | taskset.fail.patch |
diff --git a/lib/Gearman/Taskset.pm b/lib/Gearman/Taskset.pm
index 0c09964..a878b69 100644
--- a/lib/Gearman/Taskset.pm
+++ b/lib/Gearman/Taskset.pm
@@ -208,7 +208,8 @@ sub add_task {
if (! $rv) {
shift @{ $ts->{need_handle} }; # ditch it, it failed.
# this will resubmit it if it failed.
- return $task->fail;
+ return $task->fail("no rv on waiting for packet" .
+ (defined($rv) ? " $rv" : ": $!"));
}
}
@@ -280,7 +281,7 @@ sub _fail_jshandle {
my Gearman::Task $task = shift @$task_list or
die "Uhhhh: task_list is empty on work_fail for handle $shandle\n";
- $task->fail;
+ $task->fail("jshandle fail");
delete $ts->{waiting}{$shandle} unless @$task_list;
}