If there are builds in the queue that depend on another scheduled build, then hydra-queue-runner will start the dependency first and block the dependent builds. This is implemented in findBuildDependencyInQueue. However, if there are tens of thousands of such dependent builds, since each call to findBuildDependencyInQueue may take a second or so, hydra-queue-runner will spend hours just deciding which builds not to do. Thus very little progress is made.
So now, when a build is started, we immediately check which builds are "blocked" by it (i.e. depend on it), and remove such builds from consideration.
ZZYTUBG2HVWNYS5P3FHKK5L5CYN4ZVXPSUE36A27KPHOL6UPJHEAC
X3YLTWJAF7QLQGUVGDYALE75W4SJIOYZEFSGG726XRPGN576TWVQC
7DWCXNC72OO3M4YGNVV4KM775CUSPBHEFFNMRIA2XAZTQCXYHBRQC
7YBYT2LQML2PKEO6UO4444AGSASS664UCDXW2YO3ALB7THQHCEBQC
TPSCSZKXKQAMSLMRACXSHWQ4OY7HPSJSJ4KTJY6HLHZQAJ5MDRZAC
DTXTS7LNTY43YDI5FXVDEJZ75JMR4OW6WS7ZBUXXM3L242VEIIWQC
DQD7JMSUAPXKASPXUDXY4LCE6QCAZSGWNQYTOKNIQE6RRSRP4KGAC
GEADFVZ5LXXFIE3VIP4UJ4AEI2VX57DXER47JA4IHH5BG3QNPAEAC
$buildsByDrv->{$_->drvpath} = $_->id
foreach $db->resultset('Builds')->search({ finished => 0 }, { join => ['project'] });
push @{$buildsByDrv->{$_->drvpath}}, $_->id
foreach $db->resultset('Builds')->search({ finished => 0 });
# Builds in the queue of which a dependency is already building.
my $blockedBuilds = Set::Scalar->new();
blockBuilds($buildsByDrv, $blockedBuilds, $_)
foreach $db->resultset('Builds')->search({ finished => 0, busy => 1 });