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