-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
feat: add Sleeper based on futures-timer
#154
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you for your PR. But I prefer to keep gloo-timers
feature as is and only add a new feature for futures-timer
.
Thanks for the comments. I will improve it. |
@Xuanwo I pushed some changes. Let me know if a type alias for |
Thank you for your efforts; I prefer to leave them unchanged. |
80e4f72
to
d350da8
Compare
gloo-timers
with futures-timer
futures-timer
Added the requested changes, pls check it out. |
backon/Cargo.toml
Outdated
@@ -20,11 +20,12 @@ targets = [ | |||
] | |||
|
|||
[features] | |||
default = ["std", "std-blocking-sleep", "tokio-sleep", "gloo-timers-sleep"] | |||
default = ["std", "std-blocking-sleep", "tokio-sleep", "gloo-timers-sleep", "futures-timer-sleep"] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi, please do not enable this sleep by default.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ok, done
backon/src/sleep.rs
Outdated
#[cfg(all( | ||
not(feature = "tokio-sleep"), | ||
not(feature = "gloo-timers-sleep"), | ||
not(feature = "futures-timer-sleep") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
We don't need to change this. futures-timer-sleep
shoule not be part of dafault timer.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you @NumberFour8 for this!
What
This PR adds the new
FuturesTimerSleep
implementation of aSleeper
which is based on the https://docs.rs/futures-timer/latest/futures_timer/ crate.This timer is runtime agnostic and also works in WASM environments and is gated via
futures-timer-sleep
feature (enabled per default).Closes #153