diff options
author | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-08-28 13:25:31 +0200 |
---|---|---|
committer | Paul Cristian Sarbu <paul.cristian.sarbu@huawei.com> | 2024-08-29 09:09:26 +0200 |
commit | 9a23629ff179c16309c7cfdb898926be03e8b105 (patch) | |
tree | 5af2e48bcdb1fe8685cbb374d313d05730ade488 /src/other_tools/just_mr/fetch.cpp | |
parent | ded2fe967269c892d8691e0e405a4adc4c4358f4 (diff) | |
download | justbuild-9a23629ff179c16309c7cfdb898926be03e8b105.tar.gz |
just-mr maps: Properly check for missing values in map chain
The root async map in a chain of calls should always be checked
for missing value, which can happen if, e.g., a cycle happens or
a thread gets killed by the system.
Properly handle this by checking explicitly if a value has been
posted. If not, check for cycles where it makes sense (for
example, in the resolving of symlinks), otherwise report any
pending map keys not yet processed.
This is done for all just-mr commands working with async maps.
Diffstat (limited to 'src/other_tools/just_mr/fetch.cpp')
-rw-r--r-- | src/other_tools/just_mr/fetch.cpp | 18 |
1 files changed, 16 insertions, 2 deletions
diff --git a/src/other_tools/just_mr/fetch.cpp b/src/other_tools/just_mr/fetch.cpp index d236b7e8..c1d65010 100644 --- a/src/other_tools/just_mr/fetch.cpp +++ b/src/other_tools/just_mr/fetch.cpp @@ -31,6 +31,7 @@ #include "src/buildtool/logging/log_level.hpp" #include "src/buildtool/logging/logger.hpp" #include "src/buildtool/main/retry.hpp" +#include "src/buildtool/multithreading/async_map_utils.hpp" #include "src/buildtool/multithreading/task_system.hpp" #include "src/buildtool/serve_api/remote/config.hpp" #include "src/buildtool/serve_api/remote/serve_api.hpp" @@ -542,12 +543,15 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, // do the fetch bool failed_archives{false}; + bool has_value_archives{false}; { TaskSystem ts{common_args.jobs}; archive_fetch_map.ConsumeAfterKeysReady( &ts, archives_to_fetch, - []([[maybe_unused]] auto const& values) {}, + [&has_value_archives]([[maybe_unused]] auto const& values) { + has_value_archives = true; + }, [&failed_archives, &multi_repository_tool_name](auto const& msg, bool fatal) { Logger::Log(fatal ? LogLevel::Error : LogLevel::Warning, @@ -558,12 +562,15 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, }); } bool failed_git_trees{false}; + bool has_value_trees{false}; { TaskSystem ts{common_args.jobs}; git_tree_fetch_map.ConsumeAfterKeysReady( &ts, git_trees_to_fetch, - []([[maybe_unused]] auto const& values) {}, + [&has_value_trees]([[maybe_unused]] auto const& values) { + has_value_trees = true; + }, [&failed_git_trees, &multi_repository_tool_name](auto const& msg, bool fatal) { Logger::Log(fatal ? LogLevel::Error : LogLevel::Warning, @@ -582,6 +589,13 @@ auto MultiRepoFetch(std::shared_ptr<Configuration> const& config, if (failed_archives or failed_git_trees) { return kExitFetchError; } + if (not has_value_archives or not has_value_trees) { + DetectAndReportPending( + "fetch archives", archive_fetch_map, kArchiveContentPrinter); + DetectAndReportPending( + "fetch trees", git_tree_fetch_map, kGitTreeInfoPrinter); + return kExitFetchError; + } // report success Logger::Log(LogLevel::Info, "Fetch completed"); return kExitSuccess; |