protocol between the client and the worker process is currently JSON-based, all arguments and return values must be serializable to JSON. This includes most perl scalars like strings, a limited range
Document hung_worker_timeout and SIGALRM stuff
Wire protocol:
- Support something other than JSON? Sereal?
- Document the protocol?
need tests for the following features:
- checkout_done sig
file created by our parent before the fork
use IO::Select;
use JSON::XS;
use Scalar::Util qw/blessed/;
my $setup_has_been_run;
my $json;
my $sel;
sub handle_worker {
eval {
handle_worker_wr
AnyEvent::Util::fh_nonblocking $fh, 0;
AnyEvent::Util::fh_nonblocking $monitor_fh, 0;
$json = JSON::XS->new->utf8;
$sel = IO::Select->new;
$sel->add($fh, $monitor_fh);
while(1) {
m
TR};
POSIX::_exit(1);
} elsif ($read_rv == 0) {
POSIX::_exit(1);
}
for my $input ($json->incr_parse($buf)) {
my $output;
my $output_meta = {};
my $cmd = shift @$input;
->()';
shift @$request;
}
$self->_install_timeout_timer;
$self->{worker}->push_write( json => [ 'do', {}, @$request, ], );
my $timer;
if ($self->{log_defer_object}) {
$timer = $s
lete $self->{cmd_handler};
$self->_try_to_fill_requests;
};
$self->{worker}->push_read( json => $self->{cmd_handler} );
}
sub DESTROY {
my ($self) = @_;
$self->{client}->remove_pending
$self->{client}->populate_workers if $self->{client};
} else {
$worker->push_write( json => [ 'dn', {} ] );
$self->{client}->make_worker_available($worker) if $self->{client};