diff --git a/pandora_server/ChangeLog b/pandora_server/ChangeLog index 47445cd7eb..a7f451a306 100644 --- a/pandora_server/ChangeLog +++ b/pandora_server/ChangeLog @@ -1,3 +1,8 @@ +2010-07-22 Ramon Novoa + + * lib/PandoraFMS/DataServer.pm: Sort files by creation date before + queuing them. Fixes bug #3031780. + 2010-07-20 Ramon Novoa * lib/PandoraFMS/SNMPServer.pm: Add extended information when saving diff --git a/pandora_server/lib/PandoraFMS/DataServer.pm b/pandora_server/lib/PandoraFMS/DataServer.pm index 5d7e944e26..d43d2ea650 100644 --- a/pandora_server/lib/PandoraFMS/DataServer.pm +++ b/pandora_server/lib/PandoraFMS/DataServer.pm @@ -87,8 +87,13 @@ sub data_producer ($) { opendir (DIR, $pa_config->{'incomingdir'}) || die "[FATAL] Cannot open Incoming data directory at " . $pa_config->{'incomingdir'} . ": $!"; + my @files = readdir (DIR); + closedir(DIR); + + @files = sort { -C $pa_config->{'incomingdir'} . "/$b" <=> -C $pa_config->{'incomingdir'} . "/$a" } (@files); + my $queue_count = 0; - while (defined (my $file_name = readdir(DIR))) { + foreach my $file_name (@files) { if ($queue_count > $pa_config->{"max_queue_files"}) { last; } @@ -106,7 +111,6 @@ sub data_producer ($) { push (@tasks, $file_name); } - closedir(DIR); return @tasks; }