diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index b8435a307a..630b1145c6 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2011-06-02 Ramon Novoa + + * lib/PandoraFMS/DataServer.pm: Do not include BADXML files when + evaluating max_queue_files. + 2011-05-30 Ramon Novoa * lib/PandoraFMS/Core.pm: Fixed the query to get the number of unknown diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 1fddf1fedb..759328ed26 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -94,9 +94,15 @@ sub data_producer ($) { # Do not read more than max_queue_files files my $file_count = 0; while (my $file = readdir (DIR)) { + + # Data files must have the extension .data + next if ($file !~ /^.*\.data$/); + + # Do not queue more than max_queue_files files if ($file_count > $pa_config->{"max_queue_files"}) { last; } + push (@files, $file); $file_count++; } @@ -105,27 +111,7 @@ sub data_producer ($) { # Temporarily disable warnings (some files may have been deleted) { no warnings; - @files = sort { -C $pa_config->{'incomingdir'} . "/$b" <=> -C $pa_config->{'incomingdir'} . "/$a" } (@files); - } - - # Queue files - my $queue_count = 0; - foreach my $file_name (@files) { - if ($queue_count > $pa_config->{"max_queue_files"}) { - last; - } - - # For backward compatibility - if ($file_name =~ /^.*\.checksum$/) { - unlink("$pa_config->{'incomingdir'}/$file_name"); - next; - } - - # Data files must have the extension .data - next if ($file_name !~ /^.*\.data$/); - - $queue_count++; - push (@tasks, $file_name); + @tasks = sort { -C $pa_config->{'incomingdir'} . "/$b" <=> -C $pa_config->{'incomingdir'} . "/$a" } (@files); } return @tasks;