From: Tyler Riddle Date: Mon, 8 Oct 2012 19:11:33 +0000 (-0700) Subject: restore default behavior of unlimited concurrency when no concurrency limit is defined X-Git-Url: http://git.shadowcat.co.uk/gitweb/gitweb.cgi?a=commitdiff_plain;h=297332689a29b4f90ec4766a7b0c2399c558f6be;p=scpubgit%2FSystem-Introspector.git restore default behavior of unlimited concurrency when no concurrency limit is defined --- diff --git a/lib/System/Introspector/State.pm b/lib/System/Introspector/State.pm index 43b54fe..daebb40 100644 --- a/lib/System/Introspector/State.pm +++ b/lib/System/Introspector/State.pm @@ -7,11 +7,10 @@ use JSON::Diffable qw( encode_json ); use Scalar::Util qw(weaken); use System::Introspector::Gatherer; use System::Introspector::Logger qw( :log :dlog ); -use System::Introspector::Report; +use System::Introspector::Gatherer::Report; has config => (is => 'ro', required => 1); has root => (is => 'ro', required => 1); -#undef is unlimited concurrency sub user { $_[0]->config->user } sub sudo_user { $_[0]->config->sudo_user } @@ -27,8 +26,13 @@ sub gather { log_info { my $c = scalar(@hosts); "This gather run is for $c hosts" }; while(scalar(@hosts) > 0) { - my @scan = splice(@hosts, 0, $concurrent_max); - my @waiting; + my (@scan, @waiting); + + if (defined($concurrent_max)) { + @scan = splice(@hosts, 0, $concurrent_max); + } else { + @scan = @hosts; + } Dlog_trace { my $c = scalar(@scan); "Scanning $c hosts in this gather loop" } @scan;