Skip Menu |

Preferred bug tracker

Please visit the preferred bug tracker to report your issue.

This queue is for tickets about the Gearman CPAN distribution.

Report information
The Basics
Id: 46373
Status: resolved
Priority: 0/
Queue: Gearman

People
Owner: info [...] maximka.de
Requestors: drrho [...] cpan.org
Cc:
AdminCc:

Bug Information
Severity: Important
Broken in: (no value)
Fixed in: 1.130.004



Subject: Documentation Gearman::Worker wrong/misleading
The docs say Show quoted text
> Do one job and returns (no value returned).
This is not true. There is a while (1) loop which is not left unless a "stop_if" methods is called. But this is never documented. Actually these callbacks are accepted according to the code: my $stop_if = delete $opts{'stop_if'} || sub { 0 }; my $complete_cb = delete $opts{on_complete}; my $fail_cb = delete $opts{on_fail}; my $start_cb = delete $opts{on_start};
From: draxil [...] gmail.com
Yes I just got confused by this as well!
On Tue May 26 12:05:46 2009, DRRHO wrote: Show quoted text
> The docs say >
> > Do one job and returns (no value returned).
> > This is not true. There is a while (1) loop which is not left > unless a "stop_if" methods is called. But this is never documented. > > Actually these callbacks are accepted according to the code: > > my $stop_if = delete $opts{'stop_if'} || sub { 0 }; > my $complete_cb = delete $opts{on_complete}; > my $fail_cb = delete $opts{on_fail}; > my $start_cb = delete $opts{on_start};
if i $worker->work( stop_if => sub { 1 } ), the worker does one job but doesnt seem to actually return the result to the client - rather the client just hangs, waiting patiently for the result.
From: ribugent [...] gmail.com
Hello, I made a patch to fix this problem but I'm not sure if it has collateral effects. Hope this helps El Mar Ago 23 08:16:06 2011, djzort escribió: Show quoted text
> On Tue May 26 12:05:46 2009, DRRHO wrote:
> > The docs say > >
> > > Do one job and returns (no value returned).
> > > > This is not true. There is a while (1) loop which is not left > > unless a "stop_if" methods is called. But this is never documented. > > > > Actually these callbacks are accepted according to the code: > > > > my $stop_if = delete $opts{'stop_if'} || sub { 0 }; > > my $complete_cb = delete $opts{on_complete}; > > my $fail_cb = delete $opts{on_fail}; > > my $start_cb = delete $opts{on_start};
> > > if i $worker->work( stop_if => sub { 1 } ), the worker does one job but > doesnt seem to actually return the result to the client - rather the > client just hangs, waiting patiently for the result. >
Subject: fix.patch
--- Worker.pm 2009-10-05 03:36:10.000000000 +0200 +++ Worker.pm 2012-05-10 16:58:40.577501390 +0200 @@ -376,6 +376,8 @@ } $active_js{$js} = 1; + + return if $stop_if->($is_idle, $last_job_time); } my @jss; @@ -416,8 +418,6 @@ $is_idle = 0 if keys %active_js; - return if $stop_if->($is_idle, $last_job_time); - my $update_since = time - (15 + rand 60); while (my ($js, $last_update) = each %last_update_time) {
POD will be updated in v1.130.001 Patch will not be applied. stop if test passed https://github.com/p-alik/perl-Gearman/blob/master/t/60-stop-if.t without patch and failed with them.
may you check new release v1.130 please
done