diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index db0e8369f7..4338ec6222 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,9 @@ +2009-04-27 Ramon Novoa + + * lib/PandoraFMS/ProducerConsumerServer.pm, + lib/PandoraFMS/Server.pm: Properly set task queue size for + statistics. + 2009-04-24 Ramon Novoa * lib/PandoraFMS/SNMPServer.pm, lib/PandoraFMS/Core.pm: Generate diff --git a/pandora_server/lib/PandoraFMS/ProducerConsumerServer.pm b/pandora_server/lib/PandoraFMS/ProducerConsumerServer.pm index ab22093e50..fdc1516111 100644 --- a/pandora_server/lib/PandoraFMS/ProducerConsumerServer.pm +++ b/pandora_server/lib/PandoraFMS/ProducerConsumerServer.pm @@ -110,7 +110,7 @@ sub data_producer ($$$$$) { my @tasks = &{$self->{'_producer'}}($self); # Update queue size for statistics - $self->setQueueSize ($#tasks); + $self->setQueueSize (scalar @{$task_queue}); foreach my $task (@tasks) { $sem->down; diff --git a/pandora_server/lib/PandoraFMS/Server.pm b/pandora_server/lib/PandoraFMS/Server.pm index 15e72f56f2..a538c9a5a8 100644 --- a/pandora_server/lib/PandoraFMS/Server.pm +++ b/pandora_server/lib/PandoraFMS/Server.pm @@ -44,6 +44,9 @@ sub new ($$$;$) { _queue_size => 0, }; + # Share variables that may be set from different threads + share ($self->{'_queue_size'}); + # Thread kill signal handler #$SIG{'KILL'} = sub { # threads->exit() if threads->can('exit'); @@ -97,7 +100,7 @@ sub getServerID ($) { ######################################################################################## sub setQueueSize ($$) { my ($self, $size) = @_; - + $self->{'_queue_size'} = $size; } @@ -232,7 +235,7 @@ sub stop ($) { eval { # Update server status pandora_update_server ($self->{'_pa_config'}, $self->{'_dbh'}, $self->{'_pa_config'}->{'servername'}, - 0, $self->{'_server_type'}); + 0, $self->{'_server_type'}, 0, 0); # Generate an event $self->downEvent ();