Elasticsearch/Role/CxnPool/Static.pm

filter: Statementstmt 100% 21 / 21 Branchbran 100% 2 / 2 Conditioncond n/a MC/DCmcdc n/a Subroutinesub 100% 4 / 4 Podpod 50.0% 1 / 2 totaltotal 96.5% 28 / 29 CC 3 SCAR 6.9
CC
3
Cov
100%
schedule_check
3.0
BEGIN
1.0
BEGIN
1.0
CRAP 2.0
« Elasticsearch/Client/6_0/TestServer.pm ↑ Summary Elasticsearch/Transport.pm »
1 package Search::Elasticsearch::Role::CxnPool::Static;
2 37 $Search::Elasticsearch::Role::CxnPool::Static::VERSION = '6.80';
3 37 ▶use Moo::Role;
Subroutine BEGIN: called CC=1 SCAR=0.0
4 37 with 'Search::Elasticsearch::Role::CxnPool';
5 37 requires 'next_cxn';
6  
7 37 ▶use namespace::clean;
Subroutine BEGIN: called CC=1 SCAR=0.0
8  
9 #===================================
10 sub BUILD {
11 #===================================
12 81 ▶ my $self = shift;
Subroutine BUILD: called CC=1 SCAR=0.0
Pod undocumented
13 81 $self->set_cxns( @{ $self->seed_nodes } );
14 81 $self->schedule_check;
15 }
16  
17 #===================================
18 sub schedule_check {
19 #===================================
20 93 ▶ my ($self) = @_;
Subroutine schedule_check: called CC=3 SCAR=11.0
Pod documented
21 93 $self->logger->info("Forcing ping before next use on all live cxns");
22 93 for my $cxn ( @{ $self->cxns } ) {
23 105 ▶ next if $cxn->is_dead;
Branch: 1 branch
BranchTrueFalseTotal
if $cxn->is_dead 9 96 105
24 96 $self->logger->infof( "Ping [%s] before next request",
25 $cxn->stringify );
26 96 $cxn->force_ping;
27 }
28 }
29  
30 37 1;
31  
32 =pod
33  
34 =encoding UTF-8
35  
36 =head1 NAME
37  
38 Search::Elasticsearch::Role::CxnPool::Static - A CxnPool role for connecting to a remote cluster with a static list of nodes.
39  
40 =head1 VERSION
41  
42 version 6.80
43  
44 =head1 METHODS
45  
46 =head2 C<schedule_check()>
47  
48 $cxn_pool->schedule_check
49  
50 Forces a ping on each cxn in L<cxns()|Search::Elasticsearch::Role::CxnPool/cxns()>
51 before the next time that cxn is used for a request.
52  
53 =head1 AUTHOR
54  
55 Enrico Zimuel <enrico.zimuel@elastic.co>
56  
57 =head1 COPYRIGHT AND LICENSE
58  
59 This software is Copyright (c) 2020 by Elasticsearch BV.
60  
61 This is free software, licensed under:
62  
63 The Apache License, Version 2.0, January 2004
64  
65 =cut
66  
67 __END__
« Elasticsearch/Client/6_0/TestServer.pm ↑ Summary Elasticsearch/Transport.pm »