From 638ee7104f629757fe5f1e2c6dd92b999954aa44 Mon Sep 17 00:00:00 2001 From: Karen Arutyunov Date: Thu, 7 Nov 2024 10:15:49 +0200 Subject: Do not send tenant service notification in build result handler for 'forcing' build state --- mod/mod-build-result.cxx | 29 +++++++++++++++++++++++------ mod/mod-ci-github.cxx | 2 +- 2 files changed, 24 insertions(+), 7 deletions(-) diff --git a/mod/mod-build-result.cxx b/mod/mod-build-result.cxx index 3ba18e1..bc44bd2 100644 --- a/mod/mod-build-result.cxx +++ b/mod/mod-build-result.cxx @@ -248,16 +248,27 @@ handle (request& rq, response&) } else if (authenticate_session (*options_, rqm.challenge, *b, rqm.session)) { + // If the build is not in the `forcing` state, then retrieve the tenant + // service callback, if present, for subsequent notification (`queued` + // for the interrupted build and `built` otherwise; see below). Note + // that for the `forcing` state the service already assumes the `queued` + // state (see build_force::handle() and ci_start::rebuild() for + // details). + // const tenant_service_base* ts (nullptr); + shared_ptr t; - shared_ptr t (build_db_->load (b->tenant)); - - if (t->service) + if (b->force != force_state::forcing) { - auto i (tenant_service_map_.find (t->service->type)); + t = build_db_->load (b->tenant); - if (i != tenant_service_map_.end ()) - ts = i->second.get (); + if (t->service) + { + auto i (tenant_service_map_.find (t->service->type)); + + if (i != tenant_service_map_.end ()) + ts = i->second.get (); + } } // If the build is interrupted, then revert it to the original built @@ -348,6 +359,8 @@ handle (request& rq, response&) // if (tsq != nullptr) { + assert (t != nullptr); + // Calculate the tenant service hints. // buildable_package_count tpc ( @@ -498,7 +511,11 @@ handle (request& rq, response&) // If required, stash the service notification information. // if (tsb != nullptr || tsq != nullptr) + { + assert (t != nullptr); + tss = make_pair (move (*t->service), move (b)); + } } t.commit (); diff --git a/mod/mod-ci-github.cxx b/mod/mod-ci-github.cxx index 0e95aa2..e11cd4e 100644 --- a/mod/mod-ci-github.cxx +++ b/mod/mod-ci-github.cxx @@ -621,7 +621,7 @@ namespace brep } bool ci_github:: - handle_check_run_request (gh_check_run_event cr, bool warning_success) + handle_check_run_request (gh_check_run_event cr, bool /* warning_success */) { HANDLER_DIAG; -- cgit v1.1