aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-11-07 10:15:49 +0200
committerKaren Arutyunov <karen@codesynthesis.com>2024-11-07 10:15:49 +0200
commit638ee7104f629757fe5f1e2c6dd92b999954aa44 (patch)
treea94c11240b6fb09cc71407e34ca84b29205c98dd
parentacac3315dc6d5b42671d3ca5240189a69af1975b (diff)
Do not send tenant service notification in build result handler for 'forcing' build state
-rw-r--r--mod/mod-build-result.cxx29
-rw-r--r--mod/mod-ci-github.cxx2
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<build_tenant> t;
- shared_ptr<build_tenant> t (build_db_->load<build_tenant> (b->tenant));
-
- if (t->service)
+ if (b->force != force_state::forcing)
{
- auto i (tenant_service_map_.find (t->service->type));
+ t = build_db_->load<build_tenant> (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;