Skip to content

Commit

Permalink
Fix #34
Browse files Browse the repository at this point in the history
  • Loading branch information
garnier-quentin committed Jun 15, 2020
1 parent 9b2b58c commit fbc05aa
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 6 deletions.
9 changes: 5 additions & 4 deletions centreon-gorgone/gorgone/class/core.pm
Original file line number Diff line number Diff line change
Expand Up @@ -815,23 +815,24 @@ sub run {
my $poll = [@{$gorgone->{poll}}];

my $current_time = time();
if (time() - $cb_timer_check > 15) {
if (time() - $cb_timer_check > 15 || $gorgone->{stop} == 1) {
foreach my $name (keys %{$gorgone->{modules_register}}) {
my $count_module = $gorgone->{modules_register}->{$name}->{check}->(
my ($count_module, $keepalive) = $gorgone->{modules_register}->{$name}->{check}->(
logger => $gorgone->{logger},
dead_childs => $gorgone->{return_child},
internal_socket => $gorgone->{internal_socket},
dbh => $gorgone->{db_gorgone},
poll => $poll,
api_endpoints => $gorgone->{api_endpoints},
);
$cb_timer_check = time();

$count += $count_module;
if ($count_module == 0) {
if ($count_module == 0 && (!defined($keepalive) || $keepalive == 0)) {
$gorgone->unload_module(package => $name);
}
}

$cb_timer_check = time();
# We can clean return_child.
$gorgone->{return_child} = {};
}
Expand Down
2 changes: 2 additions & 0 deletions centreon-gorgone/gorgone/modules/core/httpserver/hooks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,8 @@ sub check {
if ($stop == 0) {
create_child(logger => $options{logger}, api_endpoints => $options{api_endpoints});
}

last;
}

$count++ if (defined($httpserver->{running}) && $httpserver->{running} == 1);
Expand Down
4 changes: 2 additions & 2 deletions centreon-gorgone/gorgone/modules/core/proxy/hooks.pm
Original file line number Diff line number Diff line change
Expand Up @@ -384,8 +384,8 @@ sub check {
delete $parent_ping->{$_};
}
}
return $count;

return ($count, 1);
}

sub broadcast {
Expand Down

0 comments on commit fbc05aa

Please sign in to comment.