Skip to content

Commit b28d915

Browse files
authored
chore: remove custom async sleep impl (vectordotdev#17493)
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.
1 parent ac81fc1 commit b28d915

File tree

1 file changed

+3
-12
lines changed

1 file changed

+3
-12
lines changed

src/aws/mod.rs

Lines changed: 3 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -7,13 +7,13 @@ use std::pin::Pin;
77
use std::sync::atomic::{AtomicUsize, Ordering};
88
use std::sync::Arc;
99
use std::task::{Context, Poll};
10-
use std::time::{Duration, SystemTime};
10+
use std::time::SystemTime;
1111

1212
pub use auth::{AwsAuthentication, ImdsAuthentication};
1313
use aws_config::meta::region::ProvideRegion;
1414
use aws_sigv4::http_request::{SignableRequest, SigningSettings};
1515
use aws_sigv4::SigningParams;
16-
use aws_smithy_async::rt::sleep::{AsyncSleep, Sleep};
16+
use aws_smithy_async::rt::sleep::TokioSleep;
1717
use aws_smithy_client::bounds::SmithyMiddleware;
1818
use aws_smithy_client::erase::{DynConnector, DynMiddleware};
1919
use aws_smithy_client::{Builder, SdkError};
@@ -114,7 +114,7 @@ pub async fn create_smithy_client<T: ClientBuilder>(
114114
let mut client_builder = Builder::new()
115115
.connector(connector)
116116
.middleware(middleware)
117-
.sleep_impl(Arc::new(TokioSleep));
117+
.sleep_impl(Arc::new(TokioSleep::new()));
118118
client_builder.set_retry_config(Some(retry_config.into()));
119119

120120
Ok(client_builder.build())
@@ -190,15 +190,6 @@ pub async fn sign_request(
190190
Ok(())
191191
}
192192

193-
#[derive(Debug)]
194-
pub struct TokioSleep;
195-
196-
impl AsyncSleep for TokioSleep {
197-
fn sleep(&self, duration: Duration) -> Sleep {
198-
Sleep::new(tokio::time::sleep(duration))
199-
}
200-
}
201-
202193
/// Layer for capturing the payload size for AWS API client requests and emitting internal telemetry.
203194
#[derive(Clone)]
204195
struct CaptureRequestSize {

0 commit comments

Comments
 (0)