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",
|
"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]]
|
[[package]]
|
||||||
name = "ipnet"
|
name = "ipnet"
|
||||||
version = "2.11.0"
|
version = "2.11.0"
|
||||||
@ -1891,7 +1879,6 @@ dependencies = [
|
|||||||
"image",
|
"image",
|
||||||
"indexmap 2.9.0",
|
"indexmap 2.9.0",
|
||||||
"insta",
|
"insta",
|
||||||
"instant",
|
|
||||||
"itertools 0.13.0",
|
"itertools 0.13.0",
|
||||||
"js-sys",
|
"js-sys",
|
||||||
"kcl-derive-docs",
|
"kcl-derive-docs",
|
||||||
|
@ -94,7 +94,6 @@ zip = { workspace = true }
|
|||||||
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
[target.'cfg(target_arch = "wasm32")'.dependencies]
|
||||||
console_error_panic_hook = { workspace = true }
|
console_error_panic_hook = { workspace = true }
|
||||||
futures-lite = "2.6.0"
|
futures-lite = "2.6.0"
|
||||||
instant = { version = "0.1.13", features = ["wasm-bindgen", "inaccurate"] }
|
|
||||||
js-sys = { version = "0.3.72" }
|
js-sys = { version = "0.3.72" }
|
||||||
tokio = { workspace = true, features = ["sync", "time"] }
|
tokio = { workspace = true, features = ["sync", "time"] }
|
||||||
tower-lsp = { workspace = true, features = ["runtime-agnostic"] }
|
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"] }
|
web-sys = { version = "0.3.76", features = ["console"] }
|
||||||
|
|
||||||
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
[target.'cfg(not(target_arch = "wasm32"))'.dependencies]
|
||||||
instant = "0.1.13"
|
|
||||||
tokio = { workspace = true, features = ["full"] }
|
tokio = { workspace = true, features = ["full"] }
|
||||||
tokio-tungstenite = { version = "0.26.2", features = [
|
tokio-tungstenite = { version = "0.26.2", features = [
|
||||||
"rustls-tls-native-roots",
|
"rustls-tls-native-roots",
|
||||||
|
@ -36,6 +36,7 @@ use schemars::JsonSchema;
|
|||||||
use serde::{Deserialize, Serialize};
|
use serde::{Deserialize, Serialize};
|
||||||
use tokio::sync::RwLock;
|
use tokio::sync::RwLock;
|
||||||
use uuid::Uuid;
|
use uuid::Uuid;
|
||||||
|
use web_time::Instant;
|
||||||
|
|
||||||
use crate::{
|
use crate::{
|
||||||
errors::{KclError, KclErrorDetails},
|
errors::{KclError, KclErrorDetails},
|
||||||
@ -241,7 +242,7 @@ pub trait EngineManager: std::fmt::Debug + Send + Sync + 'static {
|
|||||||
.unwrap_or_default()
|
.unwrap_or_default()
|
||||||
};
|
};
|
||||||
|
|
||||||
let current_time = instant::Instant::now();
|
let current_time = Instant::now();
|
||||||
while current_time.elapsed().as_secs() < 60 {
|
while current_time.elapsed().as_secs() < 60 {
|
||||||
let responses = self.responses().read().await.clone();
|
let responses = self.responses().read().await.clone();
|
||||||
let Some(resp) = responses.get(&id) else {
|
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.
|
// No seriously WE DO NOT WANT TO PAUSE THE WHOLE APP ON THE JS SIDE.
|
||||||
#[cfg(target_arch = "wasm32")]
|
#[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| {
|
wasm_timer::Delay::new(duration).await.map_err(|err| {
|
||||||
KclError::new_internal(KclErrorDetails::new(
|
KclError::new_internal(KclErrorDetails::new(
|
||||||
format!("Failed to sleep: {:?}", err),
|
format!("Failed to sleep: {:?}", err),
|
||||||
|
Reference in New Issue
Block a user