-
Notifications
You must be signed in to change notification settings - Fork 341
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
async-std@1.6-beta.1: wasm-timer Delay
pauses
#775
Comments
Interesting, futures-timer was a dependency before in here, so this should be fine |
Perhaps there is some misunderstanding, but The bug is probably due to this unwrap failing and defaulting to 5 seconds: https://github.com/tomaka/wasm-timer/blob/master/src/timer/global/wasm.rs#L60 I'm considering trying to work on optimizing |
ah, I didn't I like
|
Author of The reason why I didn't do it the way Nowadays there's no good reason to use |
Additionally, |
thank you @tomaka both for your hacks and the info 👍 |
Heya, e4df140 uses
wasm_timer::Delay
insrc/utils.rs
for WASM target'sTimer
implementation. When running a countdown async task in a loop with a 50 ms delay, it pauses for 4 seconds every 19 iterations (observed in both Chrome and Firefox):Switching it to
futures_timer::Delay
allows it to loop smoothly:#776 has the change, though
futures-timer
depends onasync-std
in[dev-dependencies]
, so not sure if you'd like the somewhat cyclic reference.futures-timer
backs ontogloo_timers
, which calls the browser'ssetTimeout
API. I couldn't figure out howwasm-timer
does it.The text was updated successfully, but these errors were encountered: