Skip to content

Commit

Permalink
Update wasm-timer to wasmtimer (#202)
Browse files Browse the repository at this point in the history
* update wasm-timer to wasmtimer

* move wasmtimer to wasm32 dependencies

---------

Co-authored-by: Ethan Brierley <[email protected]>
  • Loading branch information
pvichivanives and eopb authored Jan 30, 2025
1 parent 2ab1ad1 commit 0b76240
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 5 deletions.
3 changes: 3 additions & 0 deletions reqwest-middleware/CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Fixed wasm32 by disabling incompatible parts. On that target, `ClientWithMiddleware` is no longer
a Tower service and has no `ClientWithMiddleware::timeout` function.

### Changed
- Updated `wasm-timer` to `wasmtimer`

## [0.4.0] - 2024-11-08

### Breaking Changes
Expand Down
3 changes: 1 addition & 2 deletions reqwest-retry/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,7 @@ 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"
wasmtimer = "0.4.1"
getrandom = { version = "0.2.0", features = ["js"] }

[dev-dependencies]
Expand Down
4 changes: 1 addition & 3 deletions reqwest-retry/src/middleware.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 0b76240

Please sign in to comment.