Skip to content

Commit

Permalink
fixed wasm-client dependency/features
Browse files Browse the repository at this point in the history
  • Loading branch information
jstuczyn committed Dec 8, 2022
1 parent 9949a17 commit 6e16ad3
Show file tree
Hide file tree
Showing 7 changed files with 84 additions and 57 deletions.
57 changes: 29 additions & 28 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 18 additions & 3 deletions clients/client-core/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,8 @@ serde = { version = "1.0", features = ["derive"] }
tap = "1.0.1"
thiserror = "1.0.34"
url = { version ="2.2", features = ["serde"] }
sqlx = { version = "0.6.2", features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate"], optional = true }
tokio = { version = "1.21.2", features = ["time", "macros"]}
time = "0.3"
tokio = { version = "1.21.2", features = ["macros"]}
time = "0.3.17"

# internal
config = { path = "../../common/config" }
Expand All @@ -40,6 +39,15 @@ task = { path = "../../common/task" }
version = "0.1.9"
features = ["time"]

[target."cfg(not(target_arch = \"wasm32\"))".dependencies.tokio]
version = "1.21.2"
features = ["time"]

[target."cfg(not(target_arch = \"wasm32\"))".dependencies.sqlx]
version = "0.6.2"
features = ["runtime-tokio-rustls", "sqlite", "macros", "migrate"]
optional = true

[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-bindgen-futures]
version = "0.4"

Expand All @@ -54,6 +62,13 @@ rev = "b9d1a54ad514c2f230a026afe0dde341e98cd7b6"
version = "0.2.4"
features = ["futures"]

[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-utils]
path = "../../common/wasm-utils"

[target."cfg(target_arch = \"wasm32\")".dependencies.time]
version = "0.3.17"
features = ["wasm-bindgen"]

[dev-dependencies]
tempfile = "3.1.0"

Expand Down
2 changes: 1 addition & 1 deletion clients/client-core/src/client/replies/reply_controller.rs
Original file line number Diff line number Diff line change
Expand Up @@ -533,6 +533,7 @@ where
to_remove.push(*pending_reply_target);
continue
};

let diff = now - last_received_time;

if diff > self.config.max_surb_waiting_period {
Expand All @@ -548,7 +549,6 @@ where
.surbs_storage_ref()
.reset_pending_reception(&pending_reply_target)
}

for to_remove in to_remove {
self.pending_replies.remove(&to_remove);
}
Expand Down
1 change: 1 addition & 0 deletions common/client-libs/gateway-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ version = "0.4"

[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-utils]
path = "../../wasm-utils"
features = ["websocket"]

# only import it in wasm. Prefer proper tokio timer in non-wasm
[target."cfg(target_arch = \"wasm32\")".dependencies.wasm-timer]
Expand Down
6 changes: 6 additions & 0 deletions common/wasm-utils/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ wasm-bindgen-futures = "0.4"
[dependencies.tungstenite]
version = "0.13"
default-features = false
optional = true

[dependencies.web-sys]
version = "0.3"
Expand All @@ -30,3 +31,8 @@ features = [
"WebSocket",
"Window",
]
optional = true

[features]
default = []
websocket = ["tungstenite", "web-sys"]
1 change: 1 addition & 0 deletions common/wasm-utils/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ use wasm_bindgen::JsValue;
use wasm_bindgen_futures::JsFuture;
use web_sys::window;

#[cfg(feature = "websocket")]
pub mod websocket;

// will cause messages to be written as if console.log("...") was called
Expand Down
Loading

0 comments on commit 6e16ad3

Please sign in to comment.