Skip to content

Commit 742ed0e

Browse files
committed
chore: use async_std::channel instead of tokio
1 parent 674d788 commit 742ed0e

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

crates/dwn-rs-wasm/src/event_stream.rs

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1+
use async_std::channel::unbounded;
12
use dwn_rs_core::{
23
emitter::EventStreamer, subscription::SubscriptionFn, MapValue,
34
MessageEvent as CoreMessageEvent,
45
};
56
use js_sys::Promise;
6-
use tokio::sync::mpsc::unbounded_channel;
77
use tracing::{instrument, trace};
88
use wasm_bindgen::prelude::*;
99
use wasm_bindgen_futures::{spawn_local, JsFuture};
@@ -71,10 +71,10 @@ async fn subscription_for_func(
7171
listener: js_sys::Function,
7272
) -> Result<SubscriptionFn, JsError> {
7373
trace!("creating subscription for js function");
74-
let (tx, mut rx) = unbounded_channel::<(String, CoreMessageEvent, MapValue)>();
74+
let (tx, rx) = unbounded::<(String, CoreMessageEvent, MapValue)>();
7575

7676
spawn_local(async move {
77-
while let Some((tenant, evt, indexes)) = rx.recv().await {
77+
while let Ok((tenant, evt, indexes)) = rx.recv().await {
7878
trace!(
7979
tenant = ?tenant,
8080
indexes = ?indexes,
@@ -102,7 +102,7 @@ async fn subscription_for_func(
102102
id,
103103
Box::new(move |tenant, evt, indexes| {
104104
trace!("sending event to listener");
105-
tx.send((tenant, evt, indexes)).unwrap_throw();
105+
tx.send_blocking((tenant, evt, indexes)).unwrap_throw();
106106
}),
107107
);
108108

0 commit comments

Comments
 (0)