remove fixes for MCE

This commit is contained in:
Oliver Gorwits
2013-01-06 01:12:24 +00:00
parent dbb2cbecf4
commit b99b1faba5
3 changed files with 9 additions and 22 deletions

View File

@@ -4,6 +4,7 @@ bin/netdisco-daemon-fg
bin/netdisco-db-deploy
bin/netdisco-deploy
bin/netdisco-web
bin/netdisco-web-fg
Changes
inc/Module/Install.pm
inc/Module/Install/Base.pm

View File

@@ -16,7 +16,7 @@ requires 'HTML::Entities' => 0;
requires 'HTTP::Tiny' => 0;
requires 'JSON' => 0;
requires 'List::MoreUtils' => 0;
requires 'MCE' => 1.304;
requires 'MCE' => 1.305;
requires 'Net::MAC' => 0;
requires 'NetAddr::IP' => 0;
requires 'Path::Class' => 0;

View File

@@ -13,18 +13,10 @@ use App::Netdisco::Daemon::Queue ':all';
# needed to quench AF_INET6 symbol errors
use NetAddr::IP::Lite ':lower';
BEGIN {
# set temporary location in home directory
# this should probably be overridable
# set temporary MCE files' location in home directory
use Path::Class 'dir';
my $tmp_dir = dir($ENV{HOME}, 'tmp');
my $tmp_dir = ($ENV{NETDISCO_TEMP} || dir($ENV{HOME}, 'tmp'));
mkdir $tmp_dir if ! -d $tmp_dir;
$ENV{TEMP} = $tmp_dir;
# set a new process group using our own process ID
# (as this is what MCE uses to signal the children)
setpgrp($$, 0);
}
use MCE;
use Role::Tiny::With;
@@ -32,18 +24,17 @@ use Role::Tiny::With;
my $mce = MCE->new(
spawn_delay => 0.15,
job_delay => 0.15,
tmp_dir => $tmp_dir;
user_func => sub { $_[0]->worker_body },
on_post_exit => \&restart_worker,
user_tasks => build_tasks_list(),
)->run();
sub build_tasks_list {
my $tasks = [];
push @$tasks, {
my $tasks = [{
max_workers => 1,
user_begin => worker_factory('Manager'),
};
}];
set(daemon_pollers => 2)
if !defined setting('daemon_pollers');
@@ -74,11 +65,6 @@ sub worker_factory {
# $self->sendto('stderr', ">>> worker $wid starting with role $role\n");
Role::Tiny->apply_roles_to_object($self, "App::Netdisco::Daemon::Worker::$role");
# XXX temporary work around for MCE's use of __DIE__
my $mce_die = $SIG{__DIE__};
$SIG{__DIE__} = sub { CORE::die($@) if $^S; $mce_die->(@_) };
# XXX "there's nothing so permanent as temporary..." ~~ Milton Friedman
$self->worker_begin if $self->can('worker_begin');
};
}