feat: replace std::time with web_time for wasm32-unknown-unknown compatibility#239
Draft
Dicklessgreat wants to merge 1 commit intoTrueLayer:mainfrom
Draft
feat: replace std::time with web_time for wasm32-unknown-unknown compatibility#239Dicklessgreat wants to merge 1 commit intoTrueLayer:mainfrom
Dicklessgreat wants to merge 1 commit intoTrueLayer:mainfrom
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
This pull request updates the
reqwest-retrycrate to replace the usage ofstd::timewith theweb-timecrate for handling time-related functionality. This change ensures compatibility with WebAssembly (WASM) environments, wherestd::timeis not supported. The modifications span dependency updates, source code adjustments, and test updates.Dependency Update:
reqwest-retry/Cargo.toml: Addedweb-time = "1.1.0"as a dependency to replacestd::time.Code Changes:
reqwest-retry/src/middleware.rs: Replaced imports ofstd::time::{Duration, SystemTime}withweb_time::{Duration, SystemTime}across the middleware implementation.macro_rules! log_retryinreqwest-retry/src/middleware.rs: Updated example code comments to useweb_time::Durationinstead ofstd::time::Duration.Test Updates:
reqwest-retry/tests/all/retry.rs:std::time::Durationwithweb_time::Durationin multiple test functions (assert_retry_succeeds_inner,assert_retry_on_request_timeout,assert_retry_on_incomplete_message,assert_retry_on_hyper_canceled,assert_retry_on_connection_reset_by_peer). This ensures compatibility with the new dependency. [1] [2] [3] [4] [5] [6] [7]RetryTimeoutResponderstruct and itsnewmethod to useweb_time::Durationinstead ofstd::time::Duration.It works on my machine
I have already tested that this fix works on my project, by refering git url and rev hash directly.
https://github.com/Dicklessgreat/reqwest-middleware/tree/refer-my-retry-policies
Draft
This PR is draft till the underlying PR is merged TrueLayer/retry-policies#29