Change to use web-time instead of unmaintained instant crate (#7497)
This commit is contained in:
13
rust/Cargo.lock
generated
13
rust/Cargo.lock
generated
@ -1697,18 +1697,6 @@ dependencies = [
|
||||
"similar",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "instant"
|
||||
version = "0.1.13"
|
||||
source = "registry+https://github.com/rust-lang/crates.io-index"
|
||||
checksum = "e0242819d153cba4b4b05a5a8f2a7e9bbf97b6055b2a002b395c96b5ff3c0222"
|
||||
dependencies = [
|
||||
"cfg-if",
|
||||
"js-sys",
|
||||
"wasm-bindgen",
|
||||
"web-sys",
|
||||
]
|
||||
|
||||
[[package]]
|
||||
name = "ipnet"
|
||||
version = "2.11.0"
|
||||
@ -1891,7 +1879,6 @@ dependencies = [
|
||||
"image",
|
||||
"indexmap 2.9.0",
|
||||
"insta",
|
||||
"instant",
|
||||
"itertools 0.13.0",
|
||||
"js-sys",
|
||||
"kcl-derive-docs",
|
||||
|
@ -94,7 +94,6 @@ zip = { workspace = true }
|
||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||
console_error_panic_hook = { workspace = true }
|
||||
futures-lite = "2.6.0"
|
||||
instant = { version = "0.1.13", features = ["wasm-bindgen", "inaccurate"] }
|
||||
js-sys = { version = "0.3.72" }
|
||||
tokio = { workspace = true, features = ["sync", "time"] }
|
||||
tower-lsp = { workspace = true, features = ["runtime-agnostic"] }
|
||||
@ -105,7 +104,6 @@ wasm-timer = { package = "zduny-wasm-timer", version = "0.2.5" }
|
||||
web-sys = { version = "0.3.76", features = ["console"] }
|
||||
|
||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||
instant = "0.1.13"
|
||||
tokio = { workspace = true, features = ["full"] }
|
||||
tokio-tungstenite = { version = "0.26.2", features = [
|
||||
"rustls-tls-native-roots",
|
||||
|
@ -36,6 +36,7 @@ use schemars::JsonSchema;
|
||||
use serde::{Deserialize, Serialize};
|
||||
use tokio::sync::RwLock;
|
||||
use uuid::Uuid;
|
||||
use web_time::Instant;
|
||||
|
||||
use crate::{
|
||||
errors::{KclError, KclErrorDetails},
|
||||
@ -241,7 +242,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
.unwrap_or_default()
|
||||
};
|
||||
|
||||
let current_time = instant::Instant::now();
|
||||
let current_time = Instant::now();
|
||||
while current_time.elapsed().as_secs() < 60 {
|
||||
let responses = self.responses().read().await.clone();
|
||||
let Some(resp) = responses.get(&id) else {
|
||||
@ -249,7 +250,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
||||
// No seriously WE DO NOT WANT TO PAUSE THE WHOLE APP ON THE JS SIDE.
|
||||
#[cfg(target_arch = "wasm32")]
|
||||
{
|
||||
let duration = instant::Duration::from_millis(1);
|
||||
let duration = web_time::Duration::from_millis(1);
|
||||
wasm_timer::Delay::new(duration).await.map_err(|err| {
|
||||
KclError::new_internal(KclErrorDetails::new(
|
||||
format!("Failed to sleep: {:?}", err),
|
||||
|
Reference in New Issue
Block a user