Skip to content

Commit

Permalink
cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
codabrink committed Dec 12, 2024
1 parent 7b2df25 commit ef8c4e5
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 17 deletions.
11 changes: 5 additions & 6 deletions bindings_wasm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -7,25 +7,24 @@ version.workspace = true
crate-type = ["cdylib", "rlib"]

[dependencies]
console_error_panic_hook.workspace = true
hex.workspace = true
js-sys.workspace = true
prost.workspace = true
serde-wasm-bindgen = "0.6.5"
serde.workspace = true
tokio.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
tracing-web = "0.1"
tracing.workspace = true
wasm-bindgen-futures.workspace = true
wasm-bindgen.workspace = true
xmtp_api_http = { path = "../xmtp_api_http" }
xmtp_common.workspace = true
xmtp_cryptography = { path = "../xmtp_cryptography" }
xmtp_id = { path = "../xmtp_id" }
xmtp_mls = { path = "../xmtp_mls", features = ["test-utils", "http-api"] }
xmtp_common.workspace = true
xmtp_proto = { path = "../xmtp_proto", features = ["proto_full"] }
tracing-web = "0.1"
tracing.workspace = true
tracing-subscriber = { workspace = true, features = ["env-filter", "json"] }
console_error_panic_hook.workspace = true

[dev-dependencies]
wasm-bindgen-test.workspace = true
xmtp_mls = { path = "../xmtp_mls", features = ["test-utils", "http-api"] }
8 changes: 4 additions & 4 deletions xmtp_mls/src/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ use xmtp_proto::xmtp::mls::api::v1::{
GroupMessage, WelcomeMessage,
};

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
use crate::groups::device_sync::WorkerHandle;

use crate::{
Expand Down Expand Up @@ -148,7 +148,7 @@ pub struct Client<ApiClient, V = RemoteSignatureVerifier<ApiClient>> {
/// The method of verifying smart contract wallet signatures for this Client
pub(crate) scw_verifier: Arc<V>,

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
pub(crate) sync_worker_handle: Arc<parking_lot::Mutex<Option<Arc<WorkerHandle>>>>,
}

Expand All @@ -162,7 +162,7 @@ impl<ApiClient, V> Clone for Client<ApiClient, V> {
local_events: self.local_events.clone(),
scw_verifier: self.scw_verifier.clone(),

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
sync_worker_handle: self.sync_worker_handle.clone(),
}
}
Expand Down Expand Up @@ -249,7 +249,7 @@ where
context,
history_sync_url,
local_events: tx,
#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
sync_worker_handle: Arc::new(parking_lot::Mutex::default()),
scw_verifier: scw_verifier.into(),
}
Expand Down
14 changes: 7 additions & 7 deletions xmtp_mls/src/groups/device_sync.rs
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ impl RetryableError for DeviceSyncError {
}
}

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
impl<ApiClient, V> Client<ApiClient, V> {
pub fn sync_worker_handle(&self) -> Option<Arc<WorkerHandle>> {
self.sync_worker_handle.lock().clone()
Expand All @@ -145,7 +145,7 @@ where
);

let worker = SyncWorker::new(client);
#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
self.set_sync_worker_handle(worker.handle.clone());
worker.spawn_worker();
}
Expand All @@ -162,17 +162,17 @@ pub struct SyncWorker<ApiClient, V> {
retry: Retry,

// Number of events processed
#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
handle: Arc<WorkerHandle>,
}

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
pub struct WorkerHandle {
processed: AtomicUsize,
notify: Notify,
}

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
impl WorkerHandle {
pub async fn wait_for_new_events(&self, mut count: usize) -> Result<(), Elapsed> {
timeout(Duration::from_secs(3), async {
Expand Down Expand Up @@ -249,7 +249,7 @@ where
_ => {}
}

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
{
self.handle.processed.fetch_add(1, Ordering::SeqCst);
self.handle.notify.notify_waiters();
Expand Down Expand Up @@ -379,7 +379,7 @@ where
init: OnceCell::new(),
retry,

#[cfg(feature = "test-utils")]
#[cfg(any(test, feature = "test-utils"))]
handle: Arc::new(WorkerHandle {
processed: AtomicUsize::new(0),
notify: Notify::new(),
Expand Down

0 comments on commit ef8c4e5

Please sign in to comment.