Skip to content

Commit

Permalink
chore: remove custom async sleep impl (vectordotdev#17493)
Browse files Browse the repository at this point in the history
While attempting to update `aws-smithy-async`
(vectordotdev#17472) I noticed the SDK
now provides an implementation of `AsyncSleep` for tokio, so our custom
implementation is no longer needed.
  • Loading branch information
fuchsnj committed May 25, 2023
1 parent ac81fc1 commit b28d915
Showing 1 changed file with 3 additions and 12 deletions.
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

0 comments on commit b28d915

Please sign in to comment.