From 00d025da3fbc001900304544e1b698245232c178 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 31 Mar 2020 16:34:03 +0300 Subject: Fix brep-monitor not to erroneously report delay due to incomplete rebuild with new toolchain --- monitor/monitor.cxx | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/monitor/monitor.cxx b/monitor/monitor.cxx index e04c5e1..31b2af1 100644 --- a/monitor/monitor.cxx +++ b/monitor/monitor.cxx @@ -447,8 +447,9 @@ namespace brep // Prepare the package build prepared query. // // This query will only be used for toolchains that have no version - // specified on the command line to obtain the latest build across all - // toolchain versions. + // specified on the command line to obtain the latest completed build + // across all toolchain versions, if present, and the latest incomplete + // build otherwise. // using bquery = query; using prep_bquery = prepared_query; @@ -456,10 +457,13 @@ namespace brep build_id id; const auto& bid (bquery::build::id); - bquery bq ((equal (bid.package, id.package) && - bid.configuration == bquery::_ref (id.configuration) && + bquery bq ((equal (bid.package, id.package) && + bid.configuration == bquery::_ref (id.configuration) && bid.toolchain_name == bquery::_ref (id.toolchain_name)) + - "ORDER BY" + bquery::build::timestamp + "DESC" + "LIMIT 1"); + "ORDER BY" + + bquery::build::completion_timestamp + "DESC, " + + bquery::build::timestamp + "DESC" + + "LIMIT 1"); prep_bquery pbq ( conn->prepare_query ("package-build-query", bq)); -- cgit v1.1