From 240ab4c02b546d60bf703ff5907c538d7d7051cd Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Tue, 31 Mar 2020 13:10:01 +0300 Subject: Make brep-monitor not to update build delay report timestamps if --report-timeout is unspecified --- monitor/monitor.cli | 5 ++++- monitor/monitor.cxx | 36 ++++++++++++++++++++++-------------- 2 files changed, 26 insertions(+), 15 deletions(-) diff --git a/monitor/monitor.cli b/monitor/monitor.cli index 33b05f7..e4d228f 100644 --- a/monitor/monitor.cli +++ b/monitor/monitor.cli @@ -44,7 +44,10 @@ namespace brep \cb{brep-monitor} maintains its own state in the brep \cb{build} database. In particular, it records timestamps of the reported package build delays and optionally omits them from being reported again during - the timeout specified with the \cb{--report-timeout} option. + the timeout specified with the \cb{--report-timeout} option. If the + timeout is unspecified, then the report timestamps are not updated. To + report all delays and still update the timestamps specify the zero + report timeout. By default, a brief report is printed. Use the \cb{--full-report} option to obtain the full report (which may be large). diff --git a/monitor/monitor.cxx b/monitor/monitor.cxx index 31b2af1..4640409 100644 --- a/monitor/monitor.cxx +++ b/monitor/monitor.cxx @@ -509,9 +509,9 @@ namespace brep { id = build_id (p->id, c.name, t.first, t.second); - // If the toolchain version is not specified then search for - // the latest build across all toolchain versions and search - // for a specific build otherwise. + // If the toolchain version is unspecified then search for the + // latest build across all toolchain versions and search for a + // specific build otherwise. // shared_ptr b; @@ -592,13 +592,13 @@ namespace brep else delayed = (bct == timestamp_nonexistent); - // If the report timeout is not specified then report the - // delay unconditionally. Otherwise, report the active package - // build delay if the report timeout is expired and the - // archived package build delay if it was never reported. Note - // that fixing the building infrastructure won't help building - // an archived package, so reporting its build delays - // repeatedly is meaningless. + // If the report timeout is unspecified then report the delay + // unconditionally. Otherwise, report the active package build + // delay if the report timeout is expired and the archived + // package build delay if it was never reported. Note that + // fixing the building infrastructure won't help building an + // archived package, so reporting its build delays repeatedly + // is meaningless. // if (delayed && (!ops.report_timeout_specified () || @@ -721,12 +721,20 @@ namespace brep // Persist the delay report timestamps. // - transaction t (db.begin ()); + // If we don't consider the report timestamps for reporting delays, it + // seems natural not to update these timestamps either. Note that + // reporting all delays and still updating the report timestamps can be + // achieved by specifying the zero report timeout. + // + if (ops.report_timeout_specified ()) + { + transaction t (db.begin ()); - for (shared_ptr d: delays) - db.update (d); + for (shared_ptr d: delays) + db.update (d); - t.commit (); + t.commit (); + } } catch (const io_error&) { -- cgit v1.1