$jcheckq is redundant: we looked this up right at the start. This is not expected to speed things up very much, but it makes things somewhat cleaner and clearer.
Signed-off-by: Ian Jackson <ian.jack...@eu.citrix.com> --- sg-report-flight | 11 +++-------- 1 file changed, 3 insertions(+), 8 deletions(-) diff --git a/sg-report-flight b/sg-report-flight index b8d948da..bcb0d427 100755 --- a/sg-report-flight +++ b/sg-report-flight @@ -160,10 +160,6 @@ sub findaflight ($$$$$) { return undef; } - my $jcheckq= db_prepare(<<END); - SELECT status FROM jobs WHERE flight=? AND job=? -END - my $checkq= db_prepare(<<END); SELECT status FROM steps WHERE flight=? AND job=? AND testid=? AND status!='skip' @@ -263,7 +259,7 @@ $runvars_conds ORDER BY flight DESC LIMIT 1000 ) - SELECT * + SELECT flight, jobs.status FROM sub $flightsq_jobs_join WHERE (1=1) @@ -304,7 +300,7 @@ END WHERE flight=? END - while (my ($tflight) = $flightsq->fetchrow_array) { + while (my ($tflight, $tjstatus) = $flightsq->fetchrow_array) { # Recurse from the starting flight looking for relevant build # jobs. We start with all jobs in $tflight, and for each job # we also process any other jobs it refers to in *buildjob runvars. @@ -407,8 +403,7 @@ END $checkq->execute($tflight, $job, $testid); ($chkst) = $checkq->fetchrow_array(); if (!defined $chkst) { - $jcheckq->execute($tflight, $job); - my ($jchkst) = $jcheckq->fetchrow_array(); + my $jchkst = $tflight->{status}; $chkst = $jchkst if $jchkst eq 'starved'; } } -- 2.20.1