From 31b782119138859c29ac8ff54bcfe19aa00fca42 Mon Sep 17 00:00:00 2001 From: Paul Cristian Sarbu Date: Wed, 17 Jul 2024 10:28:00 +0200 Subject: Pass RetryConfig instance to Executor --- .../execution_engine/executor/executor.hpp | 21 +++++++++++++++++---- 1 file changed, 17 insertions(+), 4 deletions(-) (limited to 'src/buildtool/execution_engine/executor/executor.hpp') diff --git a/src/buildtool/execution_engine/executor/executor.hpp b/src/buildtool/execution_engine/executor/executor.hpp index 77b6800f..0f0a09ec 100644 --- a/src/buildtool/execution_engine/executor/executor.hpp +++ b/src/buildtool/execution_engine/executor/executor.hpp @@ -62,6 +62,7 @@ class ExecutorImpl { ExecutionProperties const& properties, std::vector const& dispatch_list, gsl::not_null const& auth, + gsl::not_null const& retry_config, std::chrono::milliseconds const& timeout, IExecutionAction::CacheFlag cache_flag, gsl::not_null const& stats, @@ -109,8 +110,8 @@ class ExecutorImpl { stats->IncrementActionsQueuedCounter(); } - auto alternative_api = - GetAlternativeEndpoint(properties, dispatch_list, auth); + auto alternative_api = GetAlternativeEndpoint( + properties, dispatch_list, auth, retry_config); if (alternative_api) { if (not api.ParallelRetrieveToCas( std::vector{Artifact::ObjectInfo{ @@ -667,7 +668,9 @@ class ExecutorImpl { [[nodiscard]] static inline auto GetAlternativeEndpoint( const ExecutionProperties& properties, const std::vector& dispatch_list, - const gsl::not_null& auth) -> std::unique_ptr { + const gsl::not_null& auth, + const gsl::not_null& retry_config) + -> std::unique_ptr { for (auto const& [pred, endpoint] : dispatch_list) { bool match = true; for (auto const& [k, v] : pred) { @@ -687,7 +690,7 @@ class ExecutorImpl { endpoint.host, endpoint.port, auth, - &RetryConfig::Instance(), + retry_config, config); } } @@ -708,6 +711,7 @@ class Executor { ExecutionProperties properties, std::vector dispatch_list, gsl::not_null const& auth, + gsl::not_null const& retry_config, gsl::not_null const& stats, gsl::not_null const& progress, Logger const* logger = nullptr, // log in caller logger, if given @@ -718,6 +722,7 @@ class Executor { properties_{std::move(properties)}, dispatch_list_{std::move(dispatch_list)}, auth_{*auth}, + retry_config_{*retry_config}, stats_{stats}, progress_{progress}, logger_{logger}, @@ -741,6 +746,7 @@ class Executor { action->ExecutionProperties()), dispatch_list_, &auth_, + &retry_config_, Impl::ScaleTime(timeout_, action->TimeoutScale()), action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput, stats_, @@ -760,6 +766,7 @@ class Executor { Impl::MergeProperties(properties_, action->ExecutionProperties()), dispatch_list_, &auth_, + &retry_config_, Impl::ScaleTime(timeout_, action->TimeoutScale()), action->NoCache() ? CF::DoNotCacheOutput : CF::CacheOutput, stats_, @@ -797,6 +804,7 @@ class Executor { ExecutionProperties properties_; std::vector dispatch_list_; Auth const& auth_; + RetryConfig const& retry_config_; gsl::not_null stats_; gsl::not_null progress_; Logger const* logger_; @@ -822,6 +830,7 @@ class Rebuilder { ExecutionProperties properties, std::vector dispatch_list, gsl::not_null const& auth, + gsl::not_null const& retry_config, gsl::not_null const& stats, gsl::not_null const& progress, std::chrono::milliseconds timeout = IExecutionAction::kDefaultTimeout) @@ -832,6 +841,7 @@ class Rebuilder { properties_{std::move(properties)}, dispatch_list_{std::move(dispatch_list)}, auth_{*auth}, + retry_config_{*retry_config}, stats_{stats}, progress_{progress}, timeout_{timeout} {} @@ -848,6 +858,7 @@ class Rebuilder { Impl::MergeProperties(properties_, action->ExecutionProperties()), dispatch_list_, &auth_, + &retry_config_, Impl::ScaleTime(timeout_, action->TimeoutScale()), CF::PretendCached, stats_, @@ -865,6 +876,7 @@ class Rebuilder { Impl::MergeProperties(properties_, action->ExecutionProperties()), dispatch_list_, &auth_, + &retry_config_, Impl::ScaleTime(timeout_, action->TimeoutScale()), CF::FromCacheOnly, stats_, @@ -913,6 +925,7 @@ class Rebuilder { ExecutionProperties properties_; std::vector dispatch_list_; Auth const& auth_; + RetryConfig const& retry_config_; gsl::not_null stats_; gsl::not_null progress_; std::chrono::milliseconds timeout_; -- cgit v1.2.3