The renderBuildStatusIcon function was looking at the resultInfo and schedulingInfo of each build, causing a SQL query for every build in the result.
J7EE2XZAB5EZICAZGZ6DKM4JDMH73A5AJIW6INYMWJHENIGVANQAC
AH2YD57S37LRYYP54PI4PVOM63SSOPROQZD2IT7AH5ZSM62XAQCAC
3EGKZC3CURTH4S36LMFCU57S42VARSHDAGA4J56RKNPD5VR4FKSQC
FN6V3C7MC76PKJXSOVACBTZ3XNIYEYVCSDEWCPHH34OCU66UXJEQC
JXPHAZMVKLQZ6NHALF3IH4EP34ZGP7QW75OMUTAJYK4YGU3FRGOAC
T6KISLR63EHMQ4QQI3Z46PSVQITCYNZL32K3AR2LKQ3K6ESOW3QQC
RAKTHYAIX757GPYWCHOE5H5RD3QYKQW3QKLWUIUKPHQ5QGWQXWQQC
FPK5LF53CFUEKFYJ3IYXT4UTVC6IITWJOCFATMC4PLHEUP5SIEAAC
SJN2QPWHFYKX7CJMW4XZHI2P2THH7MECZZIHQMCH6EKBZ45G3DOAC
T2232OBSNVDGHY46RY5BBB2IET5LV5OLKSSBDYUF7KAEDBUOTC7QC
BTUDUY6FY6UTRZOGLSPFNA4MVTSP7JXBD44VYF6BPKNFF6Y3CY2QC
HUH62VDLCGY5OZWD6SZG7I2EUKDS5HCL4DKOLXDTFTVR3PHIMV6QC
DEMSSSB22UI2ZN26C56UYO4NZWMDCRYKLAQARGOTSORSDXX3ZNNQC
777XFGVYXBMKXY562A2DZQ5YQLZJHIALIT7456TLUWS3HHCQ7E6QC
2PEN43XFRRVNZHKNOHY2ES3NJVNLILRNJFXKOGRRQHI5MUTHSQ2AC
3HZY24CX4U2TO74HOY4YX3LBJIYF4DLXHCIY7J2RASAC4COMSMZAC
JLDUSNUOOQNL63BOPXIWZOWFRQ5X35RWG33PJB3J3KMR6QR7TN7QC
CVWQXYKMTLQSUFPTCYR4Q47IDX7TGGYPR2UKXB3NID6YMV3GRYMQC
IK53RV4VGOHLCZGQCCIKPB45M3C7M7YMNBOJFBGZJ4LWIZNU4QNQC
ZI535LI6PJMKSOBJE33B3RRZ5S2JVTR3XPUDTSXJW6BZNTAHS3GQC
{ '+select' => ["me.statusChangeId", "me.statusChangeTime"]
, '+as' => ["statusChangeId", "statusChangeTime"]
{ '+select' => ["me.statusChangeId", "me.statusChangeTime", "resultInfo.buildStatus"]
, '+as' => ["statusChangeId", "statusChangeTime", "buildStatus"]
$c->stash->{currentBuilds} = [$c->stash->{job}->builds->search({iscurrent => 1}, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
, '+as' => ["releasename", "buildstatus"], order_by => 'system' })];
$c->stash->{currentBuilds} = [$c->stash->{job}->builds->search({iscurrent => 1}, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildStatus"]
, '+as' => ["releasename", "buildStatus"], order_by => 'system' })];
$c->stash->{lastBuilds} = [$c->stash->{job}->builds->search({ finished => 1 }, { join => 'resultInfo', '+select' => ["resultInfo.releasename", "resultInfo.buildstatus"]
, '+as' => ["releasename", "buildstatus"], order_by => 'timestamp DESC', rows => 10 })];
$c->stash->{lastBuilds} =
[ $c->stash->{job}->builds->search({ finished => 1 },
{ join => 'resultInfo',
, '+select' => ["resultInfo.releasename", "resultInfo.buildStatus"]
, '+as' => ["releasename", "buildStatus"]
, order_by => 'timestamp DESC', rows => 10
}) ];
[ joinWithResultInfo($c, $tmp)->search({ finished => 1 }, { order_by => "timestamp DESC", rows => 5 }) ];
[ joinWithResultInfo($c, $tmp)->search({ finished => 1 },
{ order_by => "timestamp DESC", rows => 5
, '+select' => ["resultInfo.buildStatus"]
, '+as' => ["buildStatus"]
}) ];
[% BLOCK renderBuildStatusIcon; %]
[% finished = build != undef ? build.finished : 1 %]
[% busy = build != undef ? build.schedulingInfo.busy : 0 %]
[% BLOCK renderBuildStatusIcon %]
[% finished = build != undef ? build.finished : 1 %]
[% busy = busy != undef ? busy : build.schedulingInfo.busy %]