diff --git a/Netdisco/Changes b/Netdisco/Changes index 22592eb2..00821b25 100644 --- a/Netdisco/Changes +++ b/Netdisco/Changes @@ -1,3 +1,9 @@ +2.005000_003 - 2013-02-24 + + [ENHANCEMENTS] + + * random() and LIMIT the number of daemon jobs requested from Netdisco queue + 2.005000_002 - 2013-02-10 [ENHANCEMENTS] diff --git a/Netdisco/META.yml b/Netdisco/META.yml index 6d35a059..444a829f 100644 --- a/Netdisco/META.yml +++ b/Netdisco/META.yml @@ -51,4 +51,4 @@ resources: homepage: http://netdisco.org/ license: http://opensource.org/licenses/bsd-license.php repository: git://netdisco.git.sourceforge.net/gitroot/netdisco/netdisco-ng -version: 2.005000_001 +version: 2.005000_002 diff --git a/Netdisco/bin/netdisco-daemon-fg b/Netdisco/bin/netdisco-daemon-fg index fe3e3142..27de63f2 100755 --- a/Netdisco/bin/netdisco-daemon-fg +++ b/Netdisco/bin/netdisco-daemon-fg @@ -56,6 +56,11 @@ sub build_tasks_list { return $tasks; } +# includes the Manager worker +sub num_workers { + return (setting('daemon_pollers') + setting('daemon_interactives')); +} + sub worker_factory { my $role = shift; return sub { diff --git a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm index eb3b052f..c7609315 100644 --- a/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm +++ b/Netdisco/lib/App/Netdisco/Daemon/Worker/Manager.pm @@ -32,10 +32,14 @@ sub worker_begin { sub worker_body { my $self = shift; + my $num_slots = $self->do('num_workers') - 1; - # get all pending jobs + # get some pending jobs my $rs = schema('netdisco')->resultset('Admin') - ->search({status => 'queued'}); + ->search( + {status => 'queued'}, + {order_by => 'random()', rows => $num_slots}, + ); while (1) { while (my $job = $rs->next) {