[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index] [OSSTEST PATCH 55/60] history reporting: Break out minflight_by_time
Move this from sg-report-host-history so we can reuse it. Signed-off-by: Ian Jackson <ian.jackson@xxxxxxxxxxxxx> --- Osstest/HistoryReport.pm | 16 ++++++++++++++++ sg-report-host-history | 13 ++----------- 2 files changed, 18 insertions(+), 11 deletions(-) diff --git a/Osstest/HistoryReport.pm b/Osstest/HistoryReport.pm index 3e2ad0d3..b851ae45 100644 --- a/Osstest/HistoryReport.pm +++ b/Osstest/HistoryReport.pm @@ -37,6 +37,7 @@ BEGIN { cache_write_entry cache_finish parallel_by_fork + minflight_by_time ); %EXPORT_TAGS = (); @@ -282,4 +283,19 @@ sub parallel_by_fork ($$$$) { exit $worst; } +sub minflight_by_time ($) { + my ($timelimit) = @_; + my $minflightsq = db_prepare(<<END); + SELECT flight + FROM flights + WHERE started >= ? + ORDER BY flight ASC + LIMIT 1 +END + my $now = time // die $!; + $minflightsq->execute($now - $timelimit); + my ($minflight,) = $minflightsq->fetchrow_array(); + $minflight //= 0; +} + 1; diff --git a/sg-report-host-history b/sg-report-host-history index 0a2e9904..efe652bb 100755 --- a/sg-report-host-history +++ b/sg-report-host-history @@ -95,19 +95,10 @@ sub computeflightsrange () { END $minflightsq->execute(); ($minflight,) = $minflightsq->fetchrow_array(); + $minflight //= 0; } else { - my $minflightsq = db_prepare(<<END); - SELECT flight - FROM flights - WHERE started >= ? - ORDER BY flight ASC - LIMIT 1 -END - my $now = time // die $!; - $minflightsq->execute($now - $timelimit); - ($minflight,) = $minflightsq->fetchrow_array(); + $minflight = minflight_by_time($timelimit); } - $minflight //= 0; $flightcond = "(flight > $minflight)"; -- 2.11.0
|
Lists.xenproject.org is hosted with RackSpace, monitoring our |