Role/Cxn/Async.pm

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