From 5f6ff55e97104e46c1b5c2c94b39ea0fca35ca7c Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Thu, 7 Mar 2024 15:44:28 +0100 Subject: just: Replace singletons for progress tracking and statistics... ...with regular instances that have controlled life-times. This avoids race conditions in tracking and reporting the results of analysis and build, as the serve endpoint can orchestrate multiple builds at the same time asynchronously. As a bonus side-effect this also ensures the correctness of the progress reporting per orchestrated build. --- src/buildtool/main/analyse.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) (limited to 'src/buildtool/main/analyse.cpp') diff --git a/src/buildtool/main/analyse.cpp b/src/buildtool/main/analyse.cpp index 6ea61de2..09973446 100644 --- a/src/buildtool/main/analyse.cpp +++ b/src/buildtool/main/analyse.cpp @@ -97,6 +97,7 @@ namespace Target = BuildMaps::Target; gsl::not_null const& result_map, gsl::not_null const& repo_config, ActiveTargetCache const& target_cache, + gsl::not_null const& stats, std::size_t jobs, std::optional const& request_action_input) -> std::optional { @@ -112,7 +113,7 @@ namespace Target = BuildMaps::Target; auto source_targets = Base::CreateSourceTargetMap(&directory_entries, repo_config, jobs); auto absent_target_map = - Target::CreateAbsentTargetMap(result_map, repo_config, jobs); + Target::CreateAbsentTargetMap(result_map, repo_config, stats, jobs); auto target_map = Target::CreateTargetMap(&source_targets, &targets_file_map, &rule_map, @@ -121,6 +122,7 @@ namespace Target = BuildMaps::Target; result_map, repo_config, target_cache, + stats, jobs); Logger::Log(LogLevel::Info, "Requested target is {}", id.ToString()); AnalysedTargetPtr target{}; -- cgit v1.2.3