Daemon/Incoming.pm

filter: Statementstmt 100% 15 / 15 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 5 / 5 Podpod n/a totaltotal 100% 20 / 20 CC 1 SCAR 0.0
CC
1
Cov
100%
BEGIN
1.0
BEGIN
1.0
BEGIN
1.0
CRAP 1.0
« Daemon/Buildd.pm ↑ Summary
1 package PkgForge::Daemon::Incoming; # -*-perl-*-
2 1 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
3 1 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 # $Id: Incoming.pm.in 14914 2010-12-01 09:41:14Z squinney@INF.ED.AC.UK $
6 # $Source:$
7 # $Revision: 14914 $
8 # $HeadURL: https://svn.lcfg.org/svn/source/tags/PkgForge-Server/PkgForge_Server_1_1_10/lib/PkgForge/Daemon/Incoming.pm.in $
9 # $Date: 2010-12-01 09:41:14 +0000 (Wed, 01 Dec 2010) $
10  
11 our $VERSION = '1.1.10';
12  
13 my $PLEASE_STOP = 0;
14  
15 1 ▶use Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
16 1 ▶use MooseX::Types::Moose qw(Int);
Subroutine BEGIN: called CC=1 SCAR=0.0
17  
18 extends 'PkgForge::Daemon', 'PkgForge::Handler::Incoming';
19  
20 has 'poll' => (
21 is => 'ro',
22 isa => Int,
23 default => 60,
24 required => 1,
25 documentation => 'Interval (in seconds) to wait between queue runs',
26 );
27  
28 override 'shutdown' => sub {
29 my ($self) = @_;
30  
31 $self->logger->notice('Handling shutdown request');
32  
33 $PLEASE_STOP = 1;
34  
35 return;
36 };
37  
38 after 'start' => sub {
39 my ($self) = @_;
40  
41 $self->logger->notice('Starting incoming queue processing daemon');
42  
43 $self->preflight();
44  
45 while ( !$PLEASE_STOP ) {
46 $self->logger->notice('Processing queue');
47 $self->execute();
48 $self->logger->notice('Finished processing queue');
49  
50 if ( !$PLEASE_STOP ) {
51 sleep $self->poll;
52 }
53 }
54  
55 $self->logger->notice('Stopping incoming queue processing daemon');
56  
57 exit 0;
58 };
59  
60 1 ▶no Moose;
Subroutine BEGIN: called CC=1 SCAR=0.0
61 __PACKAGE__->meta->make_immutable;
62  
63 1;
64 __END__
« Daemon/Buildd.pm ↑ Summary