From b5142818ed7fd8c2cf08b0acfc583bfefde352a2 Mon Sep 17 00:00:00 2001 From: Cesar Rodas Date: Wed, 4 Dec 2024 19:35:29 -0300 Subject: [PATCH] Fix bug in cfg flag --- crates/cdk/src/wallet/subscription/mod.rs | 6 ++++- crates/cdk/src/wallet/subscription/ws.rs | 31 ++++++++++++----------- 2 files changed, 21 insertions(+), 16 deletions(-) diff --git a/crates/cdk/src/wallet/subscription/mod.rs b/crates/cdk/src/wallet/subscription/mod.rs index ad9eea6a..373be46a 100644 --- a/crates/cdk/src/wallet/subscription/mod.rs +++ b/crates/cdk/src/wallet/subscription/mod.rs @@ -205,7 +205,11 @@ impl SubscriptionClient { new_subscription_recv: mpsc::Receiver, on_drop_recv: mpsc::Receiver, ) -> JoinHandle<()> { - #[cfg(any(feature = "http_subscription", target_arch = "wasm32"))] + #[cfg(any( + feature = "http_subscription", + not(feature = "mint"), + target_arch = "wasm32" + ))] return Self::http_worker( http_client, url, diff --git a/crates/cdk/src/wallet/subscription/ws.rs b/crates/cdk/src/wallet/subscription/ws.rs index db4a3fb7..d388f396 100644 --- a/crates/cdk/src/wallet/subscription/ws.rs +++ b/crates/cdk/src/wallet/subscription/ws.rs @@ -1,20 +1,21 @@ -use super::{http::http_main, WsSubscriptionBody}; -use crate::{ - mint_url::MintUrl, - nuts::nut17::{ - ws::{WsMessageOrResponse, WsMethodRequest, WsRequest, WsUnsubscribeRequest}, - Params, - }, - pub_sub::SubId, - wallet::client::HttpClientMethods, -}; +use std::collections::{HashMap, HashSet}; +use std::sync::atomic::AtomicUsize; +use std::sync::Arc; + use futures::{SinkExt, StreamExt}; -use std::{ - collections::{HashMap, HashSet}, - sync::{atomic::AtomicUsize, Arc}, -}; use tokio::sync::{mpsc, RwLock}; -use tokio_tungstenite::{connect_async, tungstenite::Message}; +use tokio_tungstenite::connect_async; +use tokio_tungstenite::tungstenite::Message; + +use super::http::http_main; +use super::WsSubscriptionBody; +use crate::mint_url::MintUrl; +use crate::nuts::nut17::ws::{ + WsMessageOrResponse, WsMethodRequest, WsRequest, WsUnsubscribeRequest, +}; +use crate::nuts::nut17::Params; +use crate::pub_sub::SubId; +use crate::wallet::client::HttpClientMethods; const MAX_ATTEMPT_FALLBACK_HTTP: usize = 10;