Skip to content

Commit 0918330

Browse files
authored
WASM: Conditionally add MissedTickBehavior (#806)
* Conditionally add MissedTickBehavior * Directly reference MissedTickBehavior
1 parent 7fcf45b commit 0918330

File tree

5 files changed

+9
-6
lines changed

5 files changed

+9
-6
lines changed

Diff for: cli/Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/Cargo.lock

+1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

Diff for: lib/core/Cargo.toml

+3-2
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ rusqlite = { git = "https://github.com/Spxg/rusqlite", rev = "e36644127f31fa6e7e
3636
"bundled",
3737
] }
3838
tokio = { version = "1", default-features = false, features = ["rt", "macros"] }
39-
tokio_with_wasm = { version = "0.8.2", features = ["rt", "macros"] }
39+
tokio_with_wasm = { version = "0.8.2", features = ["macros", "rt", "sync", "time"] }
4040
sdk-common = { workspace = true }
4141
sdk-macros = { workspace = true }
4242
rusqlite_migration = { git = "https://github.com/hydra-yse/rusqlite_migration", branch = "rusqlite-v0.33.0" }
@@ -57,7 +57,6 @@ reqwest = { version = "0.12", features = ["json"] }
5757
zbase32 = "0.1.2"
5858
x509-parser = { version = "0.16.0" }
5959
tempfile = "3"
60-
prost = "^0.11"
6160
ecies = { version = "0.2.7", default-features = false, features = ["pure"] }
6261
semver = "1.0.23"
6362
lazy_static = "1.5.0"
@@ -70,6 +69,7 @@ electrum-client = { version = "0.21.0", default-features = false, features = [
7069
] }
7170
lwk_wollet = { version = "0.9.0" }
7271
maybe-sync = { version = "0.1.1", features = ["sync"] }
72+
prost = "^0.11"
7373
tokio-stream = { version = "0.1.14", features = ["sync"] }
7474
tonic = { version = "^0.8", features = ["tls", "tls-webpki-roots"] }
7575
uuid = { version = "1.8.0", features = ["v4"] }
@@ -81,6 +81,7 @@ lwk_wollet = { version = "0.9.0", default-features = false, features = [
8181
"esplora",
8282
] }
8383
maybe-sync = "0.1.1"
84+
prost = "^0.13"
8485
uuid = { version = "1.8.0", features = ["v4", "js"] }
8586
tonic = { version = "0.12", default-features = false, features = [
8687
"codegen",

Diff for: lib/core/src/sdk.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,6 @@ use sdk_common::prelude::{FiatAPI, FiatCurrency, LnUrlPayError, LnUrlWithdrawErr
2727
use signer::SdkSigner;
2828
use swapper::boltz::proxy::BoltzProxyFetcher;
2929
use tokio::sync::{watch, RwLock};
30-
use tokio::time::MissedTickBehavior;
3130
use tokio_stream::wrappers::BroadcastStream;
3231
use tokio_with_wasm::alias as tokio;
3332
use web_time::Instant;
@@ -556,7 +555,8 @@ impl LiquidSdk {
556555
let mut current_bitcoin_block: u32 = 0;
557556
let mut shutdown_receiver = cloned.shutdown_receiver.clone();
558557
let mut interval = tokio::time::interval(Duration::from_secs(10));
559-
interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
558+
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
559+
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
560560
loop {
561561
tokio::select! {
562562
_ = interval.tick() => {

Diff for: lib/core/src/swapper/boltz/status_stream.rs

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,6 @@ use boltz_client::boltz::{
1414
use futures_util::{stream::SplitSink, SinkExt, StreamExt};
1515
use log::{debug, error, info, warn};
1616
use tokio::sync::{broadcast, watch};
17-
use tokio::time::MissedTickBehavior;
1817
use tokio_with_wasm::alias as tokio;
1918

2019
impl<P: ProxyUrlFetcher> BoltzSwapper<P> {
@@ -67,7 +66,8 @@ impl<P: ProxyUrlFetcher> SwapperStatusStream for BoltzSwapper<P> {
6766
callback.subscribe_swaps().await;
6867

6968
let mut interval = tokio::time::interval(keep_alive_ping_interval);
70-
interval.set_missed_tick_behavior(MissedTickBehavior::Skip);
69+
#[cfg(not(all(target_family = "wasm", target_os = "unknown")))]
70+
interval.set_missed_tick_behavior(tokio::time::MissedTickBehavior::Skip);
7171

7272
loop {
7373
tokio::select! {

0 commit comments

Comments
 (0)