Skip to content

Commit cd8d652

Browse files
bmc-msftdemoray
andauthored
expose internal sleep implementation (#743)
Co-authored-by: Brian Caswell <[email protected]>
1 parent 4515ed9 commit cd8d652

File tree

5 files changed

+9
-7
lines changed

5 files changed

+9
-7
lines changed

sdk/core/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[package]
22
name = "azure_core"
3-
version = "0.2.1"
3+
version = "0.2.2"
44
description = "Rust wrappers around Microsoft Azure REST APIs - Core crate"
55
readme = "README.md"
66
authors = ["Microsoft Corp."]

sdk/core/src/lib.rs

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,14 +26,14 @@ mod request;
2626
mod request_options;
2727
mod response;
2828
mod seekable_stream;
29-
mod sleep;
3029

3130
pub mod auth;
3231
pub mod headers;
3332
#[cfg(feature = "mock_transport_framework")]
3433
pub mod mock;
3534
pub mod parsing;
3635
pub mod prelude;
36+
pub mod sleep;
3737
pub mod util;
3838

3939
use uuid::Uuid;
@@ -53,6 +53,7 @@ pub use policies::*;
5353
pub use request::*;
5454
pub use response::*;
5555
pub use seekable_stream::*;
56+
pub use sleep::sleep;
5657

5758
/// A unique identifier for a request.
5859
// NOTE: only used for Storage?

sdk/core/src/sleep.rs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,14 +4,15 @@ use std::task::{Context, Poll};
44
use std::thread;
55
use std::time::Duration;
66

7-
pub(crate) fn sleep(duration: Duration) -> Sleep {
7+
pub fn sleep(duration: Duration) -> Sleep {
88
Sleep {
99
thread: None,
1010
duration,
1111
}
1212
}
1313

14-
pub(crate) struct Sleep {
14+
#[derive(Debug)]
15+
pub struct Sleep {
1516
thread: Option<thread::JoinHandle<()>>,
1617
duration: Duration,
1718
}

sdk/device_update/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,11 +23,11 @@ url = "2.2"
2323
serde = { version = "1.0", features = ["derive"] }
2424
getset = "0.1"
2525
azure_core = { path = "../core", version = "0.2" }
26-
tokio = { version = "1.0", features = ["full"] }
2726
log = "0.4"
2827
azure_identity = { path = "../identity", version = "0.2" }
2928

3029
[dev-dependencies]
30+
tokio = { version = "1.0", features = ["full"] }
3131
oauth2 = "4.0.0"
3232
mockito = "0.31"
3333
async-trait = "0.1"

sdk/device_update/src/device_update.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
use crate::{client::API_VERSION_PARAM, DeviceUpdateClient, Error, Result};
2-
use azure_core::{Error as CoreError, HttpError};
2+
use azure_core::{sleep, Error as CoreError, HttpError};
33
use chrono::{DateTime, Utc};
44
use getset::Getters;
55
use log::debug;
@@ -176,7 +176,7 @@ impl DeviceUpdateClient {
176176
debug!("Import response: {}", &resp_body);
177177

178178
loop {
179-
tokio::time::sleep(std::time::Duration::from_secs(5)).await;
179+
sleep(std::time::Duration::from_secs(5)).await;
180180
let mut uri = self.device_update_url.clone();
181181
uri.set_path(&resp_body);
182182
debug!("Requesting operational status: {}", &uri);

0 commit comments

Comments
 (0)