| line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
|
1
|
|
|
|
|
|
|
# Licensed to Elasticsearch B.V. under one or more contributor |
|
2
|
|
|
|
|
|
|
# license agreements. See the NOTICE file distributed with |
|
3
|
|
|
|
|
|
|
# this work for additional information regarding copyright |
|
4
|
|
|
|
|
|
|
# ownership. Elasticsearch B.V. licenses this file to you under |
|
5
|
|
|
|
|
|
|
# the Apache License, Version 2.0 (the "License"); you may |
|
6
|
|
|
|
|
|
|
# not use this file except in compliance with the License. |
|
7
|
|
|
|
|
|
|
# You may obtain a copy of the License at |
|
8
|
|
|
|
|
|
|
# |
|
9
|
|
|
|
|
|
|
# http://www.apache.org/licenses/LICENSE-2.0 |
|
10
|
|
|
|
|
|
|
# |
|
11
|
|
|
|
|
|
|
# Unless required by applicable law or agreed to in writing, |
|
12
|
|
|
|
|
|
|
# software distributed under the License is distributed on an |
|
13
|
|
|
|
|
|
|
# "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
|
14
|
|
|
|
|
|
|
# KIND, either express or implied. See the License for the |
|
15
|
|
|
|
|
|
|
# specific language governing permissions and limitations |
|
16
|
|
|
|
|
|
|
# under the License. |
|
17
|
|
|
|
|
|
|
|
|
18
|
|
|
|
|
|
|
package Search::Elasticsearch::Role::Cxn::Async; |
|
19
|
|
|
|
|
|
|
$Search::Elasticsearch::Role::Cxn::Async::VERSION = '7.715'; |
|
20
|
50
|
|
|
50
|
|
325483
|
use Moo::Role; |
|
|
50
|
|
|
|
|
322
|
|
|
|
50
|
|
|
|
|
321
|
|
|
21
|
|
|
|
|
|
|
|
|
22
|
50
|
|
|
50
|
|
17729
|
use Search::Elasticsearch::Util qw(new_error); |
|
|
50
|
|
|
|
|
140
|
|
|
|
50
|
|
|
|
|
425
|
|
|
23
|
50
|
|
|
50
|
|
13831
|
use namespace::clean; |
|
|
50
|
|
|
|
|
114
|
|
|
|
50
|
|
|
|
|
361
|
|
|
24
|
|
|
|
|
|
|
|
|
25
|
|
|
|
|
|
|
#=================================== |
|
26
|
|
|
|
|
|
|
sub pings_ok { |
|
27
|
|
|
|
|
|
|
#=================================== |
|
28
|
47
|
|
|
47
|
1
|
77
|
my $self = shift; |
|
29
|
47
|
|
|
|
|
180
|
$self->logger->infof( 'Pinging [%s]', $self->stringify ); |
|
30
|
|
|
|
|
|
|
|
|
31
|
|
|
|
|
|
|
$self->perform_request( |
|
32
|
|
|
|
|
|
|
{ method => 'HEAD', |
|
33
|
|
|
|
|
|
|
path => '/', |
|
34
|
|
|
|
|
|
|
timeout => $self->ping_timeout, |
|
35
|
|
|
|
|
|
|
} |
|
36
|
|
|
|
|
|
|
)->then( |
|
37
|
|
|
|
|
|
|
sub { |
|
38
|
33
|
|
|
33
|
|
7602
|
$self->logger->infof( 'Marking [%s] as live', $self->stringify ); |
|
39
|
33
|
|
|
|
|
1598
|
$self->mark_live; |
|
40
|
|
|
|
|
|
|
}, |
|
41
|
|
|
|
|
|
|
sub { |
|
42
|
14
|
|
|
14
|
|
5328
|
$self->logger->debug(@_); |
|
43
|
14
|
|
|
|
|
387
|
$self->mark_dead; |
|
44
|
14
|
|
|
|
|
1411
|
die(@_); |
|
45
|
|
|
|
|
|
|
} |
|
46
|
47
|
|
|
|
|
3450
|
); |
|
47
|
|
|
|
|
|
|
} |
|
48
|
|
|
|
|
|
|
|
|
49
|
|
|
|
|
|
|
#=================================== |
|
50
|
|
|
|
|
|
|
sub sniff { |
|
51
|
|
|
|
|
|
|
#=================================== |
|
52
|
54
|
|
|
54
|
1
|
78
|
my $self = shift; |
|
53
|
54
|
|
|
|
|
193
|
$self->logger->infof( 'Sniffing [%s]', $self->stringify ); |
|
54
|
|
|
|
|
|
|
$self->perform_request( |
|
55
|
|
|
|
|
|
|
{ method => 'GET', |
|
56
|
|
|
|
|
|
|
path => '/_nodes/http', |
|
57
|
|
|
|
|
|
|
qs => { timeout => $self->sniff_timeout . 's' }, |
|
58
|
|
|
|
|
|
|
timeout => $self->sniff_request_timeout, |
|
59
|
|
|
|
|
|
|
} |
|
60
|
|
|
|
|
|
|
)->then( |
|
61
|
41
|
|
|
41
|
|
17259
|
sub { ( $self, $_[1]->{nodes} ) }, |
|
62
|
|
|
|
|
|
|
sub { |
|
63
|
13
|
|
|
13
|
|
5458
|
$self->mark_dead; |
|
64
|
13
|
|
|
|
|
1407
|
$self->logger->debug(@_); |
|
65
|
13
|
|
|
|
|
306
|
($self); |
|
66
|
|
|
|
|
|
|
} |
|
67
|
54
|
|
|
|
|
3701
|
); |
|
68
|
|
|
|
|
|
|
} |
|
69
|
|
|
|
|
|
|
1; |
|
70
|
|
|
|
|
|
|
|
|
71
|
|
|
|
|
|
|
# ABSTRACT: Provides common functionality to async Cxn implementations |
|
72
|
|
|
|
|
|
|
|
|
73
|
|
|
|
|
|
|
__END__ |