Skip to content

chore: remove custom async sleep impl #17493

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 3 additions & 12 deletions src/aws/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,13 @@ use std::pin::Pin;
use std::sync::atomic::{AtomicUsize, Ordering};
use std::sync::Arc;
use std::task::{Context, Poll};
use std::time::{Duration, SystemTime};
use std::time::SystemTime;

pub use auth::{AwsAuthentication, ImdsAuthentication};
use aws_config::meta::region::ProvideRegion;
use aws_sigv4::http_request::{SignableRequest, SigningSettings};
use aws_sigv4::SigningParams;
use aws_smithy_async::rt::sleep::{AsyncSleep, Sleep};
use aws_smithy_async::rt::sleep::TokioSleep;
use aws_smithy_client::bounds::SmithyMiddleware;
use aws_smithy_client::erase::{DynConnector, DynMiddleware};
use aws_smithy_client::{Builder, SdkError};
Expand Down Expand Up @@ -114,7 +114,7 @@ pub async fn create_smithy_client<T: ClientBuilder>(
let mut client_builder = Builder::new()
.connector(connector)
.middleware(middleware)
.sleep_impl(Arc::new(TokioSleep));
.sleep_impl(Arc::new(TokioSleep::new()));
client_builder.set_retry_config(Some(retry_config.into()));

Ok(client_builder.build())
Expand Down Expand Up @@ -190,15 +190,6 @@ pub async fn sign_request(
Ok(())
}

#[derive(Debug)]
pub struct TokioSleep;

impl AsyncSleep for TokioSleep {
fn sleep(&self, duration: Duration) -> Sleep {
Sleep::new(tokio::time::sleep(duration))
}
}

/// Layer for capturing the payload size for AWS API client requests and emitting internal telemetry.
#[derive(Clone)]
struct CaptureRequestSize {
Expand Down