From 647d6bc3f1b82e170098e46e1ef88894efac6b8a Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Fri, 1 Nov 2013 19:24:52 +0100 Subject: [PATCH] Force creation of a new uncached eval if jobs have been removed Previously we only checked if jobs had been added. We should probably rename the "hasNewBuilds" field in the database. --- src/script/hydra-evaluator | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/src/script/hydra-evaluator b/src/script/hydra-evaluator index efaf0811..a63a27f6 100755 --- a/src/script/hydra-evaluator +++ b/src/script/hydra-evaluator @@ -176,21 +176,21 @@ sub checkJobsetWrapped { $_->update({ errormsg => $failedJobNames{$_->name} ? join '\n', @{$failedJobNames{$_->name}} : undef }) foreach $jobset->jobs->all; - my $hasNewBuilds = 0; - while (my ($id, $x) = each %buildMap) { - $hasNewBuilds = 1 if $x->{new}; - } + # Have any builds been added or removed since last time? + my $jobsetChanged = + (scalar(grep { $_->{new} } values(%buildMap)) > 0) + || (defined $prevEval && $prevEval->jobsetevalmembers->count != scalar(keys %buildMap)); my $ev = $jobset->jobsetevals->create( { hash => $argsHash , timestamp => time , checkouttime => abs($checkoutStop - $checkoutStart) , evaltime => abs($evalStop - $evalStart) - , hasnewbuilds => $hasNewBuilds - , nrbuilds => $hasNewBuilds ? scalar(keys %buildMap) : undef + , hasnewbuilds => $jobsetChanged ? 1 : 0 + , nrbuilds => $jobsetChanged ? scalar(keys %buildMap) : undef }); - if ($hasNewBuilds) { + if ($jobsetChanged) { # Create JobsetEvalMembers mappings. while (my ($id, $x) = each %buildMap) { $ev->jobsetevalmembers->create({ build => $id, isnew => $x->{new} });