From 4b3140e1e69aad3e2550e76cb710360c344db713 Mon Sep 17 00:00:00 2001 From: Peerat Vichivanives Date: Tue, 26 Nov 2024 16:16:25 -0800 Subject: [PATCH] update wasm-timer to wasmtimer --- reqwest-middleware/CHANGELOG.md | 3 +++ reqwest-retry/Cargo.toml | 4 ++-- reqwest-retry/src/middleware.rs | 4 +--- 3 files changed, 6 insertions(+), 5 deletions(-) diff --git a/reqwest-middleware/CHANGELOG.md b/reqwest-middleware/CHANGELOG.md index cfb2b91..69bed59 100644 --- a/reqwest-middleware/CHANGELOG.md +++ b/reqwest-middleware/CHANGELOG.md @@ -6,6 +6,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +### Changed +- Updated `wasm-timer` to `wasmtimer` + ## [0.4.0] - 2024-11-08 ### Breaking Changes diff --git a/reqwest-retry/Cargo.toml b/reqwest-retry/Cargo.toml index e29ed3d..bd4f37b 100644 --- a/reqwest-retry/Cargo.toml +++ b/reqwest-retry/Cargo.toml @@ -24,14 +24,14 @@ reqwest = { version = "0.12.0", default-features = false } retry-policies = "0.4" thiserror = "1.0.61" tracing = { version = "0.1.26", optional = true } +wasmtimer = "0.4.1" [target.'cfg(not(target_arch = "wasm32"))'.dependencies] hyper = "1.0" tokio = { version = "1.6.0", default-features = false, features = ["time"] } [target.'cfg(target_arch = "wasm32")'.dependencies] -parking_lot = { version = "0.11.2", features = ["wasm-bindgen"] } # work around https://github.com/tomaka/wasm-timer/issues/14 -wasm-timer = "0.2.5" + getrandom = { version = "0.2.0", features = ["js"] } [dev-dependencies] diff --git a/reqwest-retry/src/middleware.rs b/reqwest-retry/src/middleware.rs index 541e83c..a8339c1 100644 --- a/reqwest-retry/src/middleware.rs +++ b/reqwest-retry/src/middleware.rs @@ -177,9 +177,7 @@ where #[cfg(not(target_arch = "wasm32"))] tokio::time::sleep(duration).await; #[cfg(target_arch = "wasm32")] - wasm_timer::Delay::new(duration) - .await - .expect("failed sleeping"); + wasmtimer::tokio::sleep(duration).await; n_past_retries += 1; continue;