[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[OSSTEST PATCH 55/60] history reporting: Break out minflight_by_time


  • To: <xen-devel@xxxxxxxxxxxxxxxxxxxx>
  • From: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Date: Fri, 14 Aug 2020 18:22:00 +0100
  • Authentication-results: esa2.hc3370-68.iphmx.com; dkim=none (message not signed) header.i=none
  • Cc: Ian Jackson <ian.jackson@xxxxxxxxxxxxx>
  • Delivery-date: Fri, 14 Aug 2020 17:26:35 +0000
  • Ironport-sdr: ug+qUfbi1jD6fWmU3D7GzJNjm2AMiFCe/B6YfTaJvtFfHm82p5CGNHstCHu598gBeKHCCC0ts2 GA18nUliP1sg2jraTK6VXILohL+lA9d/wE8Vi+/Pa/Am7vv3Gi/OrmxY76ec6Kw2lFFlfnr/PT y5WCeHMaflgJeZj3E8f8npofG3IJeTFtfppj6OfkSrzj6CWKnntsQ9rbgRJVUkGZtja3dSKBkC hPyCfhIFMORIePBVo7YaKILsiflxt9I2xFuwY7Pvfar/DYES+wiDv8jETTNDDKPnENNnCTIV7s Rl0=
  • List-id: Xen developer discussion <xen-devel.lists.xenproject.org>

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




 


Rackspace

Lists.xenproject.org is hosted with RackSpace, monitoring our
servers 24x7x365 and backed by RackSpace's Fanatical Support®.