hydra-update-gc-roots: allow cached refs to the build's jobset

Re-executing this search_related on every access turned out to
create very problematic performance. If a jobset had a lot of
error output stored in the jobset, and there were many hundreds
or thousands of active jobs, this could easily cause >1Gbps of
network traffic.
This commit is contained in:
Graham Christensen 2022-03-19 22:43:19 -04:00
parent 22026da4f8
commit 145667cb53

View file

@ -39,10 +39,7 @@ sub keepBuild {
$build->finished;
# After #1093 merges this can become $build->jobset;
# However, with ->jobset being a column on master
# it seems DBIX gets a bit confused.
my ($jobset) = $build->search_related('jobset')->first;
my ($jobset) = $build->jobset;
print STDERR " keeping ", ($build->finished ? "" : "scheduled "), "build ", $build->id, " (",
$jobset->get_column('project'), ":", $jobset->get_column('name'), ":", $build->get_column('job'), "; ",