From 2171d8f48ba77deae98d4def1f0c250ccbeddea4 Mon Sep 17 00:00:00 2001 From: Ramon Novoa Date: Thu, 2 Jun 2011 15:28:29 +0000 Subject: [PATCH] 2011-06-02 Ramon Novoa * lib/PandoraFMS/DataServer.pm: Do not include BADXML files when evaluating max_queue_files. git-svn-id: https://svn.code.sf.net/p/pandora/code/trunk@4398 c3f86ba8-e40f-0410-aaad-9ba5e7f4b01f --- pandora_server/ChangeLog | 5 ++++ pandora_server/lib/PandoraFMS/DataServer.pm | 28 ++++++--------------- 2 files changed, 12 insertions(+), 21 deletions(-) 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;