summaryrefslogtreecommitdiff
path: root/src/buildtool/main/main.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/buildtool/main/main.cpp')
-rw-r--r--src/buildtool/main/main.cpp25
1 files changed, 25 insertions, 0 deletions
diff --git a/src/buildtool/main/main.cpp b/src/buildtool/main/main.cpp
index ad1447be..50b8f476 100644
--- a/src/buildtool/main/main.cpp
+++ b/src/buildtool/main/main.cpp
@@ -42,6 +42,7 @@
#include "src/buildtool/storage/target_cache.hpp"
#ifndef BOOTSTRAP_BUILD_TOOL
#include "src/buildtool/auth/authentication.hpp"
+#include "src/buildtool/common/remote/retry_parameters.hpp"
#include "src/buildtool/execution_api/execution_service/operation_cache.hpp"
#include "src/buildtool/execution_api/execution_service/server_implementation.hpp"
#include "src/buildtool/execution_api/remote/config.hpp"
@@ -309,6 +310,29 @@ void SetupHashFunction() {
: HashFunction::JustHash::Native);
}
+void SetupRetryConfig(RetryArguments const& args) {
+ if (args.max_attempts) {
+ if (!Retry::SetMaxAttempts(*args.max_attempts)) {
+ Logger::Log(LogLevel::Error, "Invalid value for max-attempts.");
+ std::exit(kExitFailure);
+ }
+ }
+ if (args.initial_backoff_seconds) {
+ if (!Retry::SetInitialBackoffSeconds(*args.initial_backoff_seconds)) {
+ Logger::Log(LogLevel::Error,
+ "Invalid value for initial-backoff-seconds.");
+ std::exit(kExitFailure);
+ }
+ }
+ if (args.max_backoff_seconds) {
+ if (!Retry::SetMaxBackoffSeconds(*args.max_backoff_seconds)) {
+ Logger::Log(LogLevel::Error,
+ "Invalid value for max-backoff-seconds.");
+ std::exit(kExitFailure);
+ }
+ }
+}
+
#endif // BOOTSTRAP_BUILD_TOOL
// returns path relative to `root`.
@@ -881,6 +905,7 @@ auto main(int argc, char* argv[]) -> int {
: std::nullopt;
#ifndef BOOTSTRAP_BUILD_TOOL
+ SetupRetryConfig(arguments.retry);
GraphTraverser const traverser{{jobs,
std::move(arguments.build),
std::move(stage_args),