aboutsummaryrefslogtreecommitdiff
path: root/mod
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2023-07-08 12:05:09 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2023-07-13 16:43:12 +0300
commit5af5a6c6aa4c2b31e63d64a43ab647bd6def3808 (patch)
treef0c04dad8662dadd1fd2120d475fbbb8e88aedb9 /mod
parent0a8932b1eda3b4152a542dec94b4338a2f5f9691 (diff)
Optimize build-task handler by using object loading view
Diffstat (limited to 'mod')
-rw-r--r--mod/mod-build-task.cxx13
-rw-r--r--mod/mod-builds.cxx20
2 files changed, 16 insertions, 17 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index a2e1f56..b1f7658 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -1027,7 +1027,9 @@ handle (request& rq, response& rs)
//
for (auto& bp: packages)
{
- id = move (bp.id);
+ shared_ptr<build_package>& p (bp.package);
+
+ id = p->id;
// If we are in the random package ordering mode, then cache the
// tenant the start offset refers to, if not cached yet, and check
@@ -1130,8 +1132,7 @@ handle (request& rq, response& rs)
pkg_query pq (pkg_query::build_tenant::id == id.tenant);
for (auto& tp: build_db_->query<buildable_package> (pq))
{
- shared_ptr<build_package> p (
- build_db_->load<build_package> (tp.id));
+ shared_ptr<build_package>& p (tp.package);
build_db_->load (*p, p->constraints_section);
@@ -1176,7 +1177,7 @@ handle (request& rq, response& rs)
b = make_shared<build> (
move (bid.package.tenant),
move (bid.package.name),
- bp.version,
+ p->version,
move (bid.target),
move (bid.target_config_name),
move (bid.package_config_name),
@@ -1219,8 +1220,6 @@ handle (request& rq, response& rs)
}
}
- shared_ptr<build_package> p (build_db_->load<build_package> (id));
-
for (build_package_config& pc: p->configs)
{
pkg_config_name = pc.name;
@@ -1301,7 +1300,7 @@ handle (request& rq, response& rs)
{
b = make_shared<build> (move (bid.package.tenant),
move (bid.package.name),
- move (bp.version),
+ p->version,
move (bid.target),
move (bid.target_config_name),
move (bid.package_config_name),
diff --git a/mod/mod-builds.cxx b/mod/mod-builds.cxx
index 0c9e57a..bd87d84 100644
--- a/mod/mod-builds.cxx
+++ b/mod/mod-builds.cxx
@@ -889,9 +889,9 @@ handle (request& rq, response& rs)
for (auto& bp: build_db_->query<buildable_package> (q))
{
- id = move (bp.id);
+ shared_ptr<build_package>& p (bp.package);
- shared_ptr<build_package> p (build_db_->load<build_package> (id));
+ id = p->id;
// Note: load the constrains section lazily.
//
@@ -1027,11 +1027,11 @@ handle (request& rq, response& rs)
// Iterate over packages and print unbuilt configurations. Skip the
// appropriate number of them first (for page number greater than one).
//
- for (auto& p: packages)
+ for (auto& bp: packages)
{
- id = move (p.id);
+ shared_ptr<build_package>& p (bp.package);
- shared_ptr<build_package> bp (build_db_->load<build_package> (id));
+ id = p->id;
// Copy configuration/toolchain combinations for this package,
// skipping excluded configurations.
@@ -1040,7 +1040,7 @@ handle (request& rq, response& rs)
// Load the constrains section lazily.
//
- for (const build_package_config& pc: bp->configs)
+ for (const build_package_config& pc: p->configs)
{
// Filter by package config name.
//
@@ -1054,10 +1054,10 @@ handle (request& rq, response& rs)
assert (i != target_conf_map_->end ());
- if (!bp->constraints_section.loaded ())
- build_db_->load (*bp, bp->constraints_section);
+ if (!p->constraints_section.loaded ())
+ build_db_->load (*p, p->constraints_section);
- if (!exclude (pc, bp->builds, bp->constraints, *i->second))
+ if (!exclude (pc, p->builds, p->constraints, *i->second))
unbuilt_configs.insert (
config_toolchain {ct.target,
ct.target_config,
@@ -1095,7 +1095,7 @@ handle (request& rq, response& rs)
s << TABLE(CLASS="proplist build")
<< TBODY
<< TR_NAME (id.name, string (), root, id.tenant)
- << TR_VERSION (id.name, p.version, root, id.tenant)
+ << TR_VERSION (id.name, p->version, root, id.tenant)
<< TR_VALUE ("toolchain",
string (ct.toolchain_name) + '-' +
ct.toolchain_version.string ())