diff --git a/cartographer/cloud/client/map_builder_stub.cc b/cartographer/cloud/client/map_builder_stub.cc index db41de4..a52433b 100644 --- a/cartographer/cloud/client/map_builder_stub.cc +++ b/cartographer/cloud/client/map_builder_stub.cc @@ -36,7 +36,10 @@ namespace cloud { namespace { using absl::make_unique; -constexpr int kConnectionTimeoutInSeconds = 10; +constexpr int kChannelTimeoutSeconds = 10; +constexpr int kRetryBaseDelayMilliseconds = 500; +constexpr float kRetryDelayFactor = 2.0; +constexpr int kMaxRetries = 5; } // namespace @@ -50,7 +53,7 @@ MapBuilderStub::MapBuilderStub(const std::string& server_address, << " with client_id " << client_id; std::chrono::system_clock::time_point deadline( std::chrono::system_clock::now() + - std::chrono::seconds(kConnectionTimeoutInSeconds)); + std::chrono::seconds(kChannelTimeoutSeconds)); if (!client_channel_->WaitForConnected(deadline)) { LOG(FATAL) << "Failed to connect to " << server_address; } @@ -67,9 +70,10 @@ int MapBuilderStub::AddTrajectoryBuilder( *request.add_expected_sensor_ids() = cloud::ToProto(sensor_id); } async_grpc::Client client( - client_channel_, common::FromSeconds(10), - async_grpc::CreateLimitedBackoffStrategy(common::FromMilliseconds(100), - 2.f, 5)); + client_channel_, common::FromSeconds(kChannelTimeoutSeconds), + async_grpc::CreateLimitedBackoffStrategy( + common::FromMilliseconds(kRetryBaseDelayMilliseconds), + kRetryDelayFactor, kMaxRetries)); CHECK(client.Write(request)); // Construct trajectory builder stub.