Update default entry link. Handle catch/exit on signal better, faster.

This commit is contained in:
Daniel Nichter
2013-04-09 17:32:43 -06:00
parent 1cb611b574
commit 79c8705f02
2 changed files with 11 additions and 13 deletions

View File

@@ -864,7 +864,7 @@ has 'entry_link' => (
is => 'rw', is => 'rw',
isa => 'Str', isa => 'Str',
required => 0, required => 0,
default => sub { return 'https://api.tools.percona.com' }, default => sub { return 'https://api-pws.percona.com' },
); );
has 'ua' => ( has 'ua' => (
@@ -4980,8 +4980,7 @@ sub get_api_client {
delete $state->{connecting_to_api}; delete $state->{connecting_to_api};
last; # success last; # success
} }
$interval->(); # failure, try again
$interval->();
} }
return $client, $entry_links; return $client, $entry_links;
@@ -5164,6 +5163,7 @@ sub run_agent {
interval => sub { sleep 60 }, interval => sub { sleep 60 },
); );
} }
return unless $oktorun->();
# Do a version-check every time the agent starts. If versions # Do a version-check every time the agent starts. If versions
# have changed, this can affect how services are implemented. # have changed, this can affect how services are implemented.
@@ -5177,6 +5177,7 @@ sub run_agent {
tries => 1, tries => 1,
); );
} }
return unless $oktorun->();
# Load and update the local (i.e. existing) agent, or create a new one. # Load and update the local (i.e. existing) agent, or create a new one.
my ($action, $link); my ($action, $link);
@@ -5214,6 +5215,8 @@ sub run_agent {
agent => $agent, agent => $agent,
lib_dir => $lib_dir, lib_dir => $lib_dir,
); );
return unless $oktorun->();
_info('Running agent ' . $agent->name); _info('Running agent ' . $agent->name);
# ####################################################################### # #######################################################################
@@ -6588,14 +6591,9 @@ sub _state {
# Catches signals so we can exit gracefully. # Catches signals so we can exit gracefully.
sub sig_int { sub sig_int {
my ( $signal ) = @_; my ( $signal ) = @_;
if ( $oktorun ) {
print STDERR "# Caught SIG$signal.\n";
$oktorun = 0; $oktorun = 0;
} print STDERR "# Caught SIG$signal. Use 'kill -ABRT $PID' if "
else { . "the tool does not exit normally in a few seconds.\n";
print STDERR "# Exiting on SIG$signal.\n";
exit 1;
}
} }
# ############################################################################ # ############################################################################

View File

@@ -50,7 +50,7 @@ has 'entry_link' => (
is => 'rw', is => 'rw',
isa => 'Str', isa => 'Str',
required => 0, required => 0,
default => sub { return 'https://api.tools.percona.com' }, default => sub { return 'https://api-pws.percona.com' },
); );
has 'ua' => ( has 'ua' => (