Elasticsearch/Role/CxnPool/Static.pm

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