diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2025-01-22 10:32:10 +0200 |
---|---|---|
committer | Karen Arutyunov <karen@codesynthesis.com> | 2025-01-22 12:01:15 +0200 |
commit | f2cc61de479448a227136ee278941413560ecffc (patch) | |
tree | 8d9ae58c8cb6cc314888e636ea8b0efd0dad642f /mod/mod-build-task.cxx | |
parent | b0515694b711c1ff57c2fc636e066d8639fd6da6 (diff) |
Add support for tenant_service_build_built::build_completed() notification
Diffstat (limited to 'mod/mod-build-task.cxx')
-rw-r--r-- | mod/mod-build-task.cxx | 27 |
1 files changed, 25 insertions, 2 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx index c8b1bb2..88e5618 100644 --- a/mod/mod-build-task.cxx +++ b/mod/mod-build-task.cxx @@ -2407,7 +2407,7 @@ handle (request& rq, response& rs) } // If a third-party service needs to be notified about the package - // build, then call the tenant_service_build_built::build_building() + // build, then call the tenant_service_build_building::build_building() // callback function and, if requested, update the tenant-associated // service state. // @@ -2556,9 +2556,32 @@ handle (request& rq, response& rs) { conn = build_db_->connection (); + bool build_completed (false); + if (optional<string> data = - update_tenant_service_state (conn, ss.type, ss.id, f)) + update_tenant_service_state ( + conn, ss.type, ss.id, + [&f, &build_completed] (const string& tid, + const tenant_service& ts) + { + auto r (f (tid, ts)); + build_completed = r.second; + return move (r.first); + })) + { ss.data = move (data); + } + + if (build_completed) + { + // Release the database connection since the build_completed() + // notification can potentially be time-consuming (e.g., it may + // perform an HTTP request). + // + conn.reset (); + + tsb->build_completed (b.tenant, ss, log_writer_); + } } } } |