From ddcb9f1d5deccf406bf00a945e95aa0de3d766f9 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Mon, 25 Feb 2013 20:31:49 +0100 Subject: [PATCH] Handle the case where a jobset has never been evaluated --- src/script/hydra-evaluator | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/src/script/hydra-evaluator b/src/script/hydra-evaluator index 0c11ce58..404bf989 100755 --- a/src/script/hydra-evaluator +++ b/src/script/hydra-evaluator @@ -228,7 +228,9 @@ sub checkJobset { my ($jobset) = @_; 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 { checkJobsetWrapped($jobset); @@ -248,8 +250,9 @@ sub checkJobset { # Check the jobset that hasn't been checked for the longest time. sub checkSomeJobset { my ($jobset) = $db->resultset('Jobsets')->search( - { 'project.enabled' => 1, 'me.enabled' => 1, 'lastcheckedtime' => { '<', time() - $minCheckInterval } }, - { join => 'project', order_by => [ 'lastcheckedtime' ], rows => 1 }); + { 'project.enabled' => 1, 'me.enabled' => 1 + , -or => [ 'lastcheckedtime' => undef, 'lastcheckedtime' => { '<', time() - $minCheckInterval } ] }, + { join => 'project', order_by => [ 'lastcheckedtime nulls first' ], rows => 1 }); return 0 unless defined $jobset;