Subject: | [PATCH] Correctly tally dequeue process with prefork |
Hi,
I have noticed that since dequeue childs are not correctly
tallied when using Net::Server::PreFork; as a result, when
using check_for_dequeue, more and more dequeue processes are
forked, regardless of the required number of dequeue processes.
I propse the following addition to PreFork.pm. I can provide
a proper patch with tests if this solution is OK for you.
Thanks!
Mattia
sub run_dequeue {
my( $self ) = @_;
my $pid = fork;
### trouble
if( not defined $pid ){
$self->fatal("Bad fork [$!]");
### parent
}elsif( $pid ){
$self->{server}->{children}->{$pid}->{status} = 'dequeue';
$self->{server}->{tally}{dequeue} += 1;
### child
}else{
$self->dequeue();
exit;
}
}