Skip to content

Commit

Permalink
fix(aws provider): Disable retries (#12611)
Browse files Browse the repository at this point in the history
* fix(aws provider): Disable retries

We have our own retry layer wired up with ARC so we disable AWS's retries.

This also appears to match the AWS component's previous behavior with
rusoto (see rusoto/rusoto#234 and discussion).

Signed-off-by: Jesse Szwedko <jesse@szwedko.me>

* Use RetryConfig::disabled()

Signed-off-by: Jesse Szwedko <jesse@szwedko.me>
  • Loading branch information
jszwedko committed May 5, 2022
1 parent d648376 commit 8e371f2
Show file tree
Hide file tree
Showing 8 changed files with 64 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ use aws_smithy_async::rt::sleep::{AsyncSleep, Sleep};
use aws_smithy_client::erase::DynConnector;
use aws_smithy_client::SdkError;
use aws_smithy_http::endpoint::Endpoint;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use aws_types::region::Region;
use once_cell::sync::OnceCell;
Expand Down Expand Up @@ -79,6 +80,11 @@ pub trait ClientBuilder {
sleep_impl: Arc<dyn AsyncSleep>,
) -> Self::ConfigBuilder;

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder;

fn client_from_conf_conn(builder: Self::ConfigBuilder, connector: DynConnector)
-> Self::Client;
}
Expand Down Expand Up @@ -122,6 +128,8 @@ pub async fn create_client<T: ClientBuilder>(
};

config_builder = T::with_sleep_impl(config_builder, Arc::new(TokioSleep));
// we disable retries because we have our own retry layer wired together with ARC to backoff
config_builder = T::with_retry_config(config_builder, RetryConfig::disabled());

Ok(T::client_from_conf_conn(config_builder, connector))
}
Expand Down
8 changes: 8 additions & 0 deletions src/common/s3.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::aws::ClientBuilder;
use aws_sdk_s3::{Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use std::sync::Arc;

Expand Down Expand Up @@ -35,6 +36,13 @@ impl ClientBuilder for S3ClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/common/sqs.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ use crate::aws::ClientBuilder;
use aws_sdk_sqs::{Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use std::sync::Arc;

Expand Down Expand Up @@ -35,6 +36,13 @@ impl ClientBuilder for SqsClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/sinks/aws_cloudwatch_logs/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ use crate::{
use aws_sdk_cloudwatchlogs::Client as CloudwatchLogsClient;
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;

pub struct CloudwatchLogsClientBuilder;
Expand Down Expand Up @@ -60,6 +61,13 @@ impl ClientBuilder for CloudwatchLogsClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/sinks/aws_cloudwatch_metrics.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ use aws_sdk_cloudwatch::types::SdkError;
use aws_sdk_cloudwatch::{Client as CloudwatchClient, Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use futures::{future, future::BoxFuture, stream, FutureExt, SinkExt};
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -114,6 +115,13 @@ impl ClientBuilder for CloudwatchMetricsClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/sinks/aws_kinesis_firehose/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use std::sync::Arc;
use aws_sdk_firehose::{Client as KinesisFirehoseClient, Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use futures::FutureExt;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -137,6 +138,13 @@ impl ClientBuilder for KinesisFirehoseClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/sinks/aws_kinesis_streams/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ use std::sync::Arc;
use aws_sdk_kinesis::{Client as KinesisClient, Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use futures::FutureExt;
use serde::{Deserialize, Serialize};
Expand Down Expand Up @@ -76,6 +77,13 @@ impl ClientBuilder for KinesisClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down
8 changes: 8 additions & 0 deletions src/sources/aws_s3/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use aws_sdk_s3::types::ByteStream;
use aws_sdk_s3::{Endpoint, Region};
use aws_smithy_async::rt::sleep::AsyncSleep;
use aws_smithy_client::erase::DynConnector;
use aws_smithy_types::retry::RetryConfig;
use aws_types::credentials::SharedCredentialsProvider;
use futures::stream;
use futures::{stream::StreamExt, TryStreamExt};
Expand Down Expand Up @@ -111,6 +112,13 @@ impl ClientBuilder for S3ClientBuilder {
builder.sleep_impl(sleep_impl)
}

fn with_retry_config(
builder: Self::ConfigBuilder,
retry_config: RetryConfig,
) -> Self::ConfigBuilder {
builder.retry_config(retry_config)
}

fn client_from_conf_conn(
builder: Self::ConfigBuilder,
connector: DynConnector,
Expand Down

0 comments on commit 8e371f2

Please sign in to comment.