« blib/lib/auto/share/dist/Beekeeper/chat/lib/MyApp/Service/Chat/Worker.pm
↑ Summary
blib/lib/auto/share/dist/Beekeeper/chat/lib/MyApp/Service/Chat.pm »
| 1 | package Beekeeper::Service::Supervisor; | ||||||||||
| 2 | |||||||||||
| 3 | 11 | ▶ | use strict; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 4 | 11 | ▶ | use warnings; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 5 | |||||||||||
| 6 | 11 | our $VERSION = '0.10'; | |||||||||
| 7 | |||||||||||
| 8 | 11 | ▶ | use Beekeeper::Client; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 9 | |||||||||||
| 10 | # Show errors from perspective of caller | ||||||||||
| 11 | 11 | $Carp::Internal{(__PACKAGE__)}++; | |||||||||
| 12 | |||||||||||
| 13 | |||||||||||
| 14 | 0 | ▶ | sub restart_pool { | ||||||||
|
Subroutine
restart_pool: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 15 | 0 | my ($class, %args) = @_; | |||||||||
| 16 | |||||||||||
| 17 | 0 | my $client = Beekeeper::Client->instance; | |||||||||
| 18 | 0 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 19 | |||||||||||
| 20 | 0 | $client->send_notification( | |||||||||
| 21 | method => '_bkpr.supervisor.restart_pool', | ||||||||||
| 22 | params => \%args, | ||||||||||
| 23 | ); | ||||||||||
| 24 | } | ||||||||||
| 25 | |||||||||||
| 26 | 0 | ▶ | sub restart_workers { | ||||||||
|
Subroutine
restart_workers: not called CC=1 SCAR=6.9
Pod
undocumented
| |||||||||||
| 27 | 0 | my ($class, %args) = @_; | |||||||||
| 28 | |||||||||||
| 29 | 0 | my $client = Beekeeper::Client->instance; | |||||||||
| 30 | 0 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 31 | |||||||||||
| 32 | 0 | $client->send_notification( | |||||||||
| 33 | method => '_bkpr.supervisor.restart_workers', | ||||||||||
| 34 | params => \%args, | ||||||||||
| 35 | ); | ||||||||||
| 36 | } | ||||||||||
| 37 | |||||||||||
| 38 | 1 | ▶ | sub get_workers_status { | ||||||||
|
Subroutine
get_workers_status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 39 | 1 | my ($class, %args) = @_; | |||||||||
| 40 | |||||||||||
| 41 | 1 | my $client = Beekeeper::Client->instance; | |||||||||
| 42 | 1 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 43 | 1 | my $timeout = delete $args{'timeout'}; | |||||||||
| 44 | |||||||||||
| 45 | 1 | my $resp = $client->call_remote( | |||||||||
| 46 | method => '_bkpr.supervisor.get_workers_status', | ||||||||||
| 47 | params => \%args, | ||||||||||
| 48 | timeout => $timeout, | ||||||||||
| 49 | ); | ||||||||||
| 50 | |||||||||||
| 51 | 1 | return $resp->result; | |||||||||
| 52 | } | ||||||||||
| 53 | |||||||||||
| 54 | 0 | ▶ | sub get_workers_status_async { | ||||||||
|
Subroutine
get_workers_status_async: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 55 | 0 | my ($class, %args) = @_; | |||||||||
| 56 | |||||||||||
| 57 | 0 | my $on_success = delete $args{'on_success'}; | |||||||||
| 58 | 0 | my $on_error = delete $args{'on_error'}; | |||||||||
| 59 | |||||||||||
| 60 | 0 | ▶ | unless ($on_error) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 61 | 0 | my ($file, $line) = (caller)[1,2]; | |||||||||
| 62 | 0 | ▶ | $on_error = sub { die $_[0]->message . " at $file line $line\n"; }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 63 | } | ||||||||||
| 64 | |||||||||||
| 65 | 0 | my $client = Beekeeper::Client->instance; | |||||||||
| 66 | 0 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 67 | 0 | my $timeout = delete $args{'timeout'}; | |||||||||
| 68 | |||||||||||
| 69 | 0 | $client->call_remote_async( | |||||||||
| 70 | method => '_bkpr.supervisor.get_workers_status', | ||||||||||
| 71 | params => \%args, | ||||||||||
| 72 | timeout => $timeout, | ||||||||||
| 73 | on_success => $on_success, | ||||||||||
| 74 | on_error => $on_error, | ||||||||||
| 75 | ); | ||||||||||
| 76 | } | ||||||||||
| 77 | |||||||||||
| 78 | 14 | ▶ | sub get_services_status { | ||||||||
|
Subroutine
get_services_status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||
| 79 | 14 | my ($class, %args) = @_; | |||||||||
| 80 | |||||||||||
| 81 | 14 | my $client = Beekeeper::Client->instance; | |||||||||
| 82 | 14 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 83 | 14 | my $timeout = delete $args{'timeout'}; | |||||||||
| 84 | |||||||||||
| 85 | 14 | my $resp = $client->call_remote( | |||||||||
| 86 | method => '_bkpr.supervisor.get_services_status', | ||||||||||
| 87 | params => \%args, | ||||||||||
| 88 | timeout => $timeout, | ||||||||||
| 89 | ); | ||||||||||
| 90 | |||||||||||
| 91 | 14 | return $resp->result; | |||||||||
| 92 | } | ||||||||||
| 93 | |||||||||||
| 94 | 0 | ▶ | sub get_services_status_async { | ||||||||
|
Subroutine
get_services_status_async: not called CC=2 SCAR=17.9
Pod
documented
| |||||||||||
| 95 | 0 | my ($class, %args) = @_; | |||||||||
| 96 | |||||||||||
| 97 | 0 | my $on_success = delete $args{'on_success'}; | |||||||||
| 98 | 0 | my $on_error = delete $args{'on_error'}; | |||||||||
| 99 | |||||||||||
| 100 | 0 | ▶ | unless ($on_error) { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 101 | 0 | my ($file, $line) = (caller)[1,2]; | |||||||||
| 102 | 0 | ▶ | $on_error = sub { die $_[0]->message . " at $file line $line\n"; }; | ||||||||
|
Subroutine
__ANON__: not called CC=1 SCAR=6.9
| |||||||||||
| 103 | } | ||||||||||
| 104 | |||||||||||
| 105 | 0 | my $client = Beekeeper::Client->instance; | |||||||||
| 106 | 0 | my $guard = $client->__use_authorization_token('BKPR_ADMIN'); | |||||||||
| 107 | 0 | my $timeout = delete $args{'timeout'}; | |||||||||
| 108 | |||||||||||
| 109 | 0 | $client->call_remote_async( | |||||||||
| 110 | method => '_bkpr.supervisor.get_services_status', | ||||||||||
| 111 | params => \%args, | ||||||||||
| 112 | timeout => $timeout, | ||||||||||
| 113 | on_success => $on_success, | ||||||||||
| 114 | on_error => $on_error, | ||||||||||
| 115 | ); | ||||||||||
| 116 | } | ||||||||||
| 117 | |||||||||||
| 118 | 11 | 1; | |||||||||
| 119 | |||||||||||
| 120 | __END__ | ||||||||||