aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorKaren Arutyunov <karen@codesynthesis.com>2024-02-13 18:40:13 +0300
committerKaren Arutyunov <karen@codesynthesis.com>2024-02-13 18:40:21 +0300
commitf5ed92e8dbdfd751276ebb054669ca649b28e43c (patch)
tree6252037468f4f7faa4e215d13c9da8fc32f0bc03
parentcdbd2f8b36b555cb56b510fccf29fb5a12d66f80 (diff)
Optimize database query in build-task service
-rw-r--r--mod/mod-build-task.cxx21
1 files changed, 10 insertions, 11 deletions
diff --git a/mod/mod-build-task.cxx b/mod/mod-build-task.cxx
index 1c21c3a..01d14cd 100644
--- a/mod/mod-build-task.cxx
+++ b/mod/mod-build-task.cxx
@@ -885,23 +885,22 @@ handle (request& rq, response& rs)
using prep_bld_query = prepared_query<build>;
package_id id;
- string pkg_config_name;
+ string pkg_config;
bld_query sq (false);
for (const auto& cm: conf_machines)
- sq = sq || (bld_query::id.target == cm.first.target &&
- bld_query::id.target_config_name == cm.first.config &&
- bld_query::id.package_config_name ==
- bld_query::_ref (pkg_config_name));
+ sq = sq || (bld_query::id.target == cm.first.target &&
+ bld_query::id.target_config_name == cm.first.config);
bld_query bq (
- equal<build> (bld_query::id.package, id) &&
- sq &&
- bld_query::id.toolchain_name == tqm.toolchain_name &&
+ equal<build> (bld_query::id.package, id) &&
+ bld_query::id.package_config_name == bld_query::_ref (pkg_config) &&
+ sq &&
+ bld_query::id.toolchain_name == tqm.toolchain_name &&
compare_version_eq (bld_query::id.toolchain_version,
canonical_version (toolchain_version),
- true /* revision */) &&
+ true /* revision */) &&
(bld_query::state == "built" ||
(bld_query::force == "forcing" &&
@@ -1223,7 +1222,7 @@ handle (request& rq, response& rs)
for (build_package_config& pc: p->configs)
{
- pkg_config_name = pc.name;
+ pkg_config = pc.name;
// Iterate through the built configurations and erase them from the
// build configuration map. All those configurations that remained
@@ -1279,7 +1278,7 @@ handle (request& rq, response& rs)
build_id bid (move (id),
cm.config->target,
cm.config->name,
- move (pkg_config_name),
+ move (pkg_config),
move (tqm.toolchain_name),
toolchain_version);