Handle the case where a jobset has never been evaluated

This commit is contained in:
Eelco Dolstra 2013-02-25 20:31:49 +01:00
parent 65db523e46
commit ddcb9f1d5d

View file

@ -228,7 +228,9 @@ sub checkJobset {
my ($jobset) = @_; my ($jobset) = @_;
print STDERR "considering jobset ", $jobset->project->name, ":", $jobset->name, print STDERR "considering jobset ", $jobset->project->name, ":", $jobset->name,
" (last checked ", time() - $jobset->lastcheckedtime, "s ago)\n"; $jobset->lastcheckedtime
? " (last checked " . (time() - $jobset->lastcheckedtime) . "s ago)\n"
: " (never checked)\n";
eval { eval {
checkJobsetWrapped($jobset); checkJobsetWrapped($jobset);
@ -248,8 +250,9 @@ sub checkJobset {
# Check the jobset that hasn't been checked for the longest time. # Check the jobset that hasn't been checked for the longest time.
sub checkSomeJobset { sub checkSomeJobset {
my ($jobset) = $db->resultset('Jobsets')->search( my ($jobset) = $db->resultset('Jobsets')->search(
{ 'project.enabled' => 1, 'me.enabled' => 1, 'lastcheckedtime' => { '<', time() - $minCheckInterval } }, { 'project.enabled' => 1, 'me.enabled' => 1
{ join => 'project', order_by => [ 'lastcheckedtime' ], rows => 1 }); , -or => [ 'lastcheckedtime' => undef, 'lastcheckedtime' => { '<', time() - $minCheckInterval } ] },
{ join => 'project', order_by => [ 'lastcheckedtime nulls first' ], rows => 1 });
return 0 unless defined $jobset; return 0 unless defined $jobset;