Role/Cxn/Async.pm

filter: Statementstmt 88.4% 23 / 26 Branchbran n/a Conditioncond n/a MC/DCmcdc n/a Subroutinesub 77.7% 7 / 9 Podpod 100% 2 / 2 totaltotal 86.4% 32 / 37 CC 1 SCAR 2.0
CC
1
Cov
88%
__ANON__
2.0
__ANON__
2.0
pings_ok
1.0
CRAP 1.2
« Async.pm ↑ Summary CxnPool/Async/Static/NoPing.pm »
1 package Search::Elasticsearch::Role::Cxn::Async;
2 50 $Search::Elasticsearch::Role::Cxn::Async::VERSION = '6.80';
3 50 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4  
5 50 ▶use Search::Elasticsearch::Util qw(new_error);
Subroutine BEGIN: called CC=1 SCAR=0.0
6 50 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 #===================================
9 sub pings_ok {
10 #===================================
11 20 ▶ my $self = shift;
Subroutine pings_ok: called CC=1 SCAR=0.2
Pod documented
12 20 $self->logger->infof( 'Pinging [%s]', $self->stringify );
13  
14 $self->perform_request(
15 { method => 'HEAD',
16 path => '/',
17 timeout => $self->ping_timeout,
18 }
19 )->then(
20 sub {
21 0 ▶ $self->logger->infof( 'Marking [%s] as live', $self->stringify );
Subroutine __ANON__: not called CC=1 SCAR=6.9
22 0 $self->mark_live;
23 },
24 sub {
25 20 ▶ $self->logger->debug(@_);
Subroutine __ANON__: called CC=1 SCAR=0.0
26 20 $self->mark_dead;
27 20 die(@_);
28 }
29 20 );
30 }
31  
32 #===================================
33 sub sniff {
34 #===================================
35 22 ▶ my $self = shift;
Subroutine sniff: called CC=1 SCAR=0.0
Pod documented
36 22 $self->logger->infof( 'Sniffing [%s]', $self->stringify );
37 $self->perform_request(
38 { method => 'GET',
39 path => '/_nodes/http',
40 qs => { timeout => $self->sniff_timeout . 's' },
41 timeout => $self->sniff_request_timeout,
42 }
43 )->then(
44 0 ▶ sub { ( $self, $_[1]->{nodes} ) },
Subroutine __ANON__: not called CC=1 SCAR=6.9
45 sub {
46 22 ▶ $self->mark_dead;
Subroutine __ANON__: called CC=1 SCAR=0.0
47 22 $self->logger->debug(@_);
48 22 ($self);
49 }
50 22 );
51 }
52 50 1;
53  
54 # ABSTRACT: Provides common functionality to async Cxn implementations
55  
56 __END__
« Async.pm ↑ Summary CxnPool/Async/Static/NoPing.pm »