App-MonM
view release on metacpan or search on metacpan
lib/App/MonM/Daemon.pm view on Meta::CPAN
# Notifier object init
my %nargs = (config => $ctk->configobj);
$self->{notifier} = $NOTIFIER_LOADED && lvalue($ctk->config("usemonotifier"))
? App::MonM::Notifier->new(%nargs)
: App::MonM::QNotifier->new(%nargs);
# Create Checkit object
$self->{checker} = App::MonM::Checkit->new;
# Create process timers
my $ctrl = AnyEvent->timer (after => START_DELAY, interval => INTERVAL_CTRL, cb => sub {
$quit_program->send(1) unless $self->ok;
});
my $interval = int(uv2zero(lvalue($ctk->config("interval"))) || INTERVAL_MAIN); # Time interval. 1 op per n sec
my $after = (($self->{workerident} - 1) * int($interval / ($self->{forkers} - 1))) || START_DELAY;
my $timer = AnyEvent->timer (after => $after, interval => $interval, cb => sub {
$quit_program->send(1) unless $self->ok;
$self->slave($alloc); # Go!
});
my $rmnd = AnyEvent->timer (after => INTERVAL_REMIND+START_DELAY, interval => INTERVAL_REMIND, cb => sub {
$quit_program->send(1) unless $self->ok;
$self->remind() if $self->{workerident} == 1;
});
# Run!
$quit_program->recv;
return 1;
}
sub remind {
( run in 1.883 second using v1.01-cache-2.11-cpan-49f99fa48dc )