diff --git a/src/script/hydra-update-gc-roots b/src/script/hydra-update-gc-roots index a8c9de81..e22b5764 100755 --- a/src/script/hydra-update-gc-roots +++ b/src/script/hydra-update-gc-roots @@ -94,7 +94,7 @@ foreach my $project ($db->resultset('Projects')->search({}, { order_by => ["name [ "select b2.id from Builds b2 join " . " (select distinct job, system, coalesce( " . " (select id from builds where project = b.project and jobset = b.jobset and job = b.job and system = b.system and finished = 1 and buildStatus = 0 order by id desc offset ? limit 1)" . - " , 0) nth from builds b where project = ? and jobset = ? and isCurrent = 1) x " . + " , 0) as nth from builds b where project = ? and jobset = ? and isCurrent = 1) x " . " on b2.project = ? and b2.jobset = ? and b2.job = x.job and b2.system = x.system and (id >= x.nth) where finished = 1 and buildStatus = 0" , [ '', $keepnr - 1 ], [ '', $project->name ], [ '', $jobset->name ], [ '', $project->name ], [ '', $jobset->name ] ] } },