| 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::CxnPool::Async::Static::NoPing; | ||
| 6 | 7 | $Search::Elasticsearch::CxnPool::Async::Static::NoPing::VERSION = '7.30_1'; # TRIAL | |
| 7 | |||
| 8 | 7 | $Search::Elasticsearch::CxnPool::Async::Static::NoPing::VERSION = '7.301'; | |
| 9 | 7 | ▶ | use Moo; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 10 | 7 | with 'Search::Elasticsearch::Role::CxnPool::Static::NoPing', | |
| 11 | 'Search::Elasticsearch::Role::Is_Async'; | ||
| 12 | |||
| 13 | 7 | ▶ | use Promises qw(deferred); |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 14 | 7 | ▶ | use Try::Tiny; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 15 | 7 | ▶ | use namespace::clean; |
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||
| 16 | |||
| 17 | #=================================== | ||
| 18 | around 'next_cxn' => sub { | ||
| 19 | #=================================== | ||
| 20 | 9 | ▶ | my ( $orig, $self ) = @_; |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 21 | |||
| 22 | 9 | my $deferred = deferred; | |
| 23 | try { | ||
| 24 | 9 | ▶ | my $cxn = $orig->($self); |
|
Subroutine
__ANON__: called CC=1 SCAR=0.0
| |||
| 25 | 9 | $deferred->resolve($cxn); | |
| 26 | } | ||
| 27 | catch { | ||
| 28 | 0 | ▶ | $deferred->reject($_); |
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||
| 29 | 9 | }; | |
| 30 | |||
| 31 | 9 | $deferred->promise; | |
| 32 | |||
| 33 | 7 | }; | |
| 34 | |||
| 35 | 7 | 1; | |
| 36 | |||
| 37 | # ABSTRACT: An async CxnPool for connecting to a remote cluster without the ability to ping. | ||
| 38 | |||
| 39 | __END__ | ||