[#160] Job Queue fatal error on num_slots

This commit is contained in:
Oliver Gorwits
2014-11-13 21:44:33 +00:00
parent 78a31b9b1c
commit 5a1ed2e313
2 changed files with 5 additions and 5 deletions

View File

@@ -1,9 +1,10 @@
2.029013 -
2.029013_001 - 2014-11-13
[BUG FIXES]
* Fix for latest DBIx::Class (deploy)
* Fix for latest Dancer (YAML::XS)
* [#160] Job Queue fatal error on num_slots
2.029012 - 2014-10-09

View File

@@ -27,17 +27,16 @@ our %EXPORT_TAGS = ( all => \@EXPORT_OK );
sub jq_getsome {
my ($num_slots, $prio) = @_;
return () if defined $num_slots and $num_slots eq '0';
$num_slots ||= 1;
return () if ((!defined $num_slots) or ($num_slots < 1));
$prio ||= 'normal';
my @returned = ();
my $rs = schema('netdisco')->resultset('Admin')
->search(
{status => 'queued', action => { -in => setting('job_prio')->{$prio} } },
{order_by => 'random()', rows => ($num_slots || 1)},
{order_by => 'random()', rows => $num_slots},
);
my @returned = ();
while (my $job = $rs->next) {
push @returned, App::Netdisco::Daemon::Job->new({ $job->get_columns });
}