diff options
author | Boris Kolpackov <boris@codesynthesis.com> | 2024-11-05 09:28:01 +0200 |
---|---|---|
committer | Boris Kolpackov <boris@codesynthesis.com> | 2024-12-10 16:44:49 +0200 |
commit | ba1b6e96d3675d3dc7021213f08ed56359648ee4 (patch) | |
tree | e78fc32ac51b5cf1b75aefa90b0e4da3d79395c0 /mod/ci-common.cxx | |
parent | 33ee65453e6a5c6bbb1d5c10f78b3c3b2e4bca40 (diff) |
Update tenant service data in ci_start::rebuild()
Diffstat (limited to 'mod/ci-common.cxx')
-rw-r--r-- | mod/ci-common.cxx | 23 |
1 files changed, 22 insertions, 1 deletions
diff --git a/mod/ci-common.cxx b/mod/ci-common.cxx index 5b039ef..c7dfdb9 100644 --- a/mod/ci-common.cxx +++ b/mod/ci-common.cxx @@ -819,10 +819,16 @@ namespace brep } optional<build_state> ci_start:: - rebuild (odb::core::database& db, const build_id& id) const + rebuild (odb::core::database& db, + const build_id& id, + function<optional<string> (const tenant_service&, + build_state)> uf) const { using namespace odb::core; + //@@@ Should we not retry transactions (here and in other functions that + // update)? + // NOTE: don't forget to update build_force::handle() if changing anything // here. // @@ -850,6 +856,21 @@ namespace brep b->force = force; db.update (b); } + + if (uf != nullptr) + { + shared_ptr<build_tenant> t (db.load<build_tenant> (b->tenant)); + + assert (t->service); + + tenant_service& ts (*t->service); + + if (optional<string> data = uf (ts, s)) + { + ts.data = move (*data); + db.update (t); + } + } } t.commit (); |