From b9ebd38edf387d10997c9ed07c78d461f8196427 Mon Sep 17 00:00:00 2001 From: Eelco Dolstra Date: Wed, 28 Oct 2015 14:54:54 +0100 Subject: [PATCH] Fix restarting builds Failed paths were not cleared because the $builds query becomes empty as soon as the "finished" flag has been cleared. So this needs to be done last. --- src/lib/Hydra/Helper/Nix.pm | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/lib/Hydra/Helper/Nix.pm b/src/lib/Hydra/Helper/Nix.pm index d25d58c0..1d1747c0 100644 --- a/src/lib/Hydra/Helper/Nix.pm +++ b/src/lib/Hydra/Helper/Nix.pm @@ -453,11 +453,6 @@ sub restartBuilds($$) { my $nrRestarted = 0; txn_do($db, sub { - $nrRestarted = $builds->update( - { finished => 0 - , iscachedbuild => 0 - }); - # Reset the stats for the evals to which the builds belongs. # !!! Should do this in a trigger. $db->resultset('JobsetEvals')->search( @@ -473,6 +468,11 @@ sub restartBuilds($$) { { path => { -in => $builds->search({}, { join => "buildstepoutputs", select => "buildstepoutputs.path", as => "path", distinct => 1 })->as_query } })->delete; print STDERR "cleared $cleared failed paths\n"; + + $nrRestarted = $builds->update( + { finished => 0 + , iscachedbuild => 0 + }); }); return $nrRestarted;