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

View File

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